2022-11-15 11:36:54 +03:00
|
|
|
import { describe, beforeEach, it, expect, vi } from 'vitest'
|
2022-10-04 19:18:50 +03:00
|
|
|
import { shallowMount } from '@vue/test-utils'
|
2022-11-15 11:36:54 +03:00
|
|
|
|
2023-03-04 12:36:53 +03:00
|
|
|
import DesktopCard from '@/components/Settings/Tabs/VueTorrent/VDesktopCard.vue'
|
2022-10-04 19:18:50 +03:00
|
|
|
|
|
|
|
let wrapper
|
|
|
|
|
2023-03-04 12:36:53 +03:00
|
|
|
describe('DesktopCard', () => {
|
2022-11-15 11:36:54 +03:00
|
|
|
beforeEach(() => {
|
2023-03-04 12:36:53 +03:00
|
|
|
wrapper = shallowMount(DesktopCard, {
|
2022-11-15 11:36:54 +03:00
|
|
|
mocks: {
|
|
|
|
$t: x => x,
|
|
|
|
$store: {
|
|
|
|
getters: { getAppVersion: vi.fn() },
|
|
|
|
state: {
|
|
|
|
webuiSettings: {
|
|
|
|
lang: 'en',
|
|
|
|
darkTheme: false,
|
|
|
|
showFreeSpace: true,
|
|
|
|
showSpeedGraph: true,
|
|
|
|
showSessionStat: true,
|
|
|
|
showAlltimeStat: true,
|
|
|
|
showCurrentSpeed: true,
|
|
|
|
showTrackerFilter: false,
|
|
|
|
showSpeedInTitle: false,
|
|
|
|
deleteWithFiles: false,
|
|
|
|
title: 'Default',
|
|
|
|
rightDrawer: false,
|
|
|
|
paginationSize: 15,
|
2023-03-04 12:36:53 +03:00
|
|
|
busyDesktopTorrentProperties: [
|
2022-11-15 11:36:54 +03:00
|
|
|
{ name: 'Size', active: true },
|
|
|
|
{ name: 'Progress', active: true },
|
|
|
|
{ name: 'Download', active: true },
|
|
|
|
{ name: 'Upload', active: true },
|
|
|
|
{ name: 'Downloaded', active: true },
|
|
|
|
{ name: 'Uploaded', active: true },
|
|
|
|
{ name: 'ETA', active: true },
|
|
|
|
{ name: 'Peers', active: true },
|
|
|
|
{ name: 'Seeds', active: true },
|
|
|
|
{ name: 'Status', active: true },
|
|
|
|
{ name: 'Ratio', active: true },
|
|
|
|
{ name: 'Category', active: true },
|
|
|
|
{ name: 'Tags', active: true },
|
|
|
|
{ name: 'AddedOn', active: true },
|
|
|
|
{ name: 'Availability', active: true }
|
|
|
|
],
|
2023-03-04 12:36:53 +03:00
|
|
|
doneDesktopTorrentProperties: [
|
2022-11-15 11:36:54 +03:00
|
|
|
{ name: 'Size', active: true },
|
|
|
|
{ name: 'Progress', active: true },
|
|
|
|
{ name: 'Download', active: true },
|
|
|
|
{ name: 'Upload', active: true },
|
|
|
|
{ name: 'Downloaded', active: true },
|
|
|
|
{ name: 'Uploaded', active: true },
|
|
|
|
{ name: 'ETA', active: true },
|
|
|
|
{ name: 'Peers', active: true },
|
|
|
|
{ name: 'Seeds', active: true },
|
|
|
|
{ name: 'Status', active: true },
|
|
|
|
{ name: 'Ratio', active: true },
|
|
|
|
{ name: 'Category', active: true },
|
|
|
|
{ name: 'Tags', active: true },
|
|
|
|
{ name: 'AddedOn', active: true },
|
|
|
|
{ name: 'Availability', active: true }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-04 19:18:50 +03:00
|
|
|
})
|
2022-11-15 11:36:54 +03:00
|
|
|
})
|
2022-10-04 19:18:50 +03:00
|
|
|
|
2022-11-15 11:36:54 +03:00
|
|
|
it('render correctly', () => {
|
|
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
|
|
})
|
2022-10-04 19:18:50 +03:00
|
|
|
|
2023-03-04 12:36:53 +03:00
|
|
|
it('tests busyDesktopTorrentProperties', () => {
|
|
|
|
const busyDesktopTorrentProperties = [
|
2022-12-30 13:20:23 +03:00
|
|
|
{ name: 'Size', label: 'Size', active: true },
|
|
|
|
{ name: 'Progress', label: 'Progress', active: true },
|
|
|
|
{ name: 'Download', label: 'Download Speed', active: true },
|
|
|
|
{ name: 'Upload', label: 'Upload Speed', active: true },
|
|
|
|
{ name: 'Downloaded', label: 'Downloaded', active: true },
|
|
|
|
{ name: 'Uploaded', label: 'Uploaded', active: true },
|
|
|
|
{ name: 'ETA', label: 'ETA', active: true },
|
|
|
|
{ name: 'Peers', label: 'Peers', active: true },
|
|
|
|
{ name: 'Seeds', label: 'Seeds', active: true },
|
|
|
|
{ name: 'Status', label: 'State', active: true },
|
|
|
|
{ name: 'Ratio', label: 'Ratio', active: true },
|
|
|
|
{ name: 'Category', label: 'Category', active: true },
|
|
|
|
{ name: 'Tags', label: 'Tags', active: true },
|
|
|
|
{ name: 'AddedOn', label: 'Added On', active: true },
|
|
|
|
{ name: 'Availability', label: 'Availability', active: true }
|
2022-11-15 11:36:54 +03:00
|
|
|
]
|
2023-03-04 12:36:53 +03:00
|
|
|
expect(wrapper.vm.busyDesktopTorrentProperties).toEqual(busyDesktopTorrentProperties)
|
2022-11-15 11:36:54 +03:00
|
|
|
})
|
2022-10-04 19:18:50 +03:00
|
|
|
|
2023-03-04 12:36:53 +03:00
|
|
|
it('tests doneDesktopTorrentProperties', () => {
|
|
|
|
const doneDesktopTorrentProperties = [
|
2022-12-30 13:20:23 +03:00
|
|
|
{ name: 'Size', label: 'Size', active: true },
|
|
|
|
{ name: 'Progress', label: 'Progress', active: true },
|
|
|
|
{ name: 'Download', label: 'Download Speed', active: true },
|
|
|
|
{ name: 'Upload', label: 'Upload Speed', active: true },
|
|
|
|
{ name: 'Downloaded', label: 'Downloaded', active: true },
|
|
|
|
{ name: 'Uploaded', label: 'Uploaded', active: true },
|
|
|
|
{ name: 'ETA', label: 'ETA', active: true },
|
|
|
|
{ name: 'Peers', label: 'Peers', active: true },
|
|
|
|
{ name: 'Seeds', label: 'Seeds', active: true },
|
|
|
|
{ name: 'Status', label: 'State', active: true },
|
|
|
|
{ name: 'Ratio', label: 'Ratio', active: true },
|
|
|
|
{ name: 'Category', label: 'Category', active: true },
|
|
|
|
{ name: 'Tags', label: 'Tags', active: true },
|
|
|
|
{ name: 'AddedOn', label: 'Added On', active: true },
|
|
|
|
{ name: 'Availability', label: 'Availability', active: true }
|
2022-11-15 11:36:54 +03:00
|
|
|
]
|
2023-03-04 12:36:53 +03:00
|
|
|
expect(wrapper.vm.doneDesktopTorrentProperties).toEqual(doneDesktopTorrentProperties)
|
2022-11-15 11:36:54 +03:00
|
|
|
})
|
2022-10-04 19:18:50 +03:00
|
|
|
})
|