Added testcases for General Component (#502)

This commit is contained in:
Nitin Ramnani 2022-10-02 01:50:38 +05:30 committed by GitHub
parent cf8f43aac3
commit 4c5613204a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 183 additions and 0 deletions

View file

@ -0,0 +1,63 @@
import { shallowMount } from '@vue/test-utils'
import General from '../../src/components/Settings/Tabs/VueTorrent/General.vue'
let wrapper
describe('General', () => {
beforeEach(() => {
wrapper = shallowMount(General,{ mocks: { $t: () => {} , $store: {
getters:{getAppVersion:jest.fn()},
state: { webuiSettings: {
showCurrentSpeed:100,
showSpeedGraph:true,
showSessionStat:true,
showAlltimeStat:true,
showTrackerFilter:true,
rightDrawer:10,
paginationSize:10,
title:'test',
lang:'English'} }
}
} })
})
it('render correctly', () => {
expect(wrapper.html()).toMatchSnapshot()
})
it('tests showCurrentSpeed',()=>{
expect(wrapper.vm.showCurrentSpeed).toEqual(100)
})
it('tests showSpeedGraph',()=>{
expect(wrapper.vm.showSpeedGraph).toEqual(true)
})
it('tests showSessionStat',()=>{
expect(wrapper.vm.showSessionStat).toEqual(true)
})
it('tests showAlltimeStat',()=>{
expect(wrapper.vm.showAlltimeStat).toEqual(true)
})
it('tests showTrackerFilter',()=>{
expect(wrapper.vm.showTrackerFilter).toEqual(true)
})
it('tests rightDrawer',()=>{
expect(wrapper.vm.rightDrawer).toEqual(10)
})
it('tests paginationSize',()=>{
expect(wrapper.vm.paginationSize).toEqual(10)
})
it('tests title',()=>{
expect(wrapper.vm.title).toEqual('test')
})
it('tests lang',()=>{
expect(wrapper.vm.lang).toEqual('English')
})
})

View file

@ -0,0 +1,120 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`General render correctly 1`] = `
<v-card-stub loaderheight="4" tag="div" flat="true">
<v-subheader-stub>
</v-subheader-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inputvalue="100" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inputvalue="true" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inputvalue="true" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inputvalue="true" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inputvalue="true" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub tag="div">
<v-switch-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" backgroundcolor="" hidedetails="true" ripple="true" valuecomparator="[Function]" inputvalue="10" inset="true" class="v-input--reverse pa-0 ma-0"></v-switch-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub cols="8" sm="8" md="10" tag="div">
<p class="subtitle-1 mt-2">
</p>
</v-col-stub>
<v-col-stub cols="4" sm="4" md="2" tag="div">
<v-select-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" value="English" appendicon="$dropdown" backgroundcolor="background" dense="true" hidedetails="true" loaderheight="2" clearicon="$clear" flat="true" solo="true" type="text" valuecomparator="[Function]" nodatatext="$vuetify.noDataText" items="en,es,fr,id,it,ja,nl,pt-br,ru,ua,vi,zh-hans,zh-hant" itemcolor="primary" itemdisabled="disabled" itemtext="text" itemvalue="value" menuprops="[object Object]" class="rounded-xl"></v-select-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub cols="8" sm="8" md="10" tag="div">
<p class="subtitle-1 mt-2">
</p>
</v-col-stub>
<v-col-stub cols="4" sm="4" md="2" tag="div">
<v-select-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" value="10" appendicon="$dropdown" backgroundcolor="background" dense="true" hidedetails="true" loaderheight="2" clearicon="$clear" flat="true" solo="true" type="text" valuecomparator="[Function]" nodatatext="$vuetify.noDataText" items="5,15,30,50" itemcolor="primary" itemdisabled="disabled" itemtext="text" itemvalue="value" menuprops="[object Object]" class="rounded-xl"></v-select-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub cols="8" sm="8" md="10" tag="div">
<p class="subtitle-1 mt-2">
</p>
</v-col-stub>
<v-col-stub cols="4" sm="4" md="2" tag="div">
<v-select-stub errorcount="1" errormessages="" messages="" rules="" successmessages="" value="test" appendicon="$dropdown" backgroundcolor="background" dense="true" hidedetails="true" loaderheight="2" clearicon="$clear" flat="true" solo="true" type="text" valuecomparator="[Function]" nodatatext="$vuetify.noDataText" items="Default,Global Speed,First Torrent Status" itemcolor="primary" itemdisabled="disabled" itemtext="text" itemvalue="value" menuprops="[object Object]" class="rounded-xl"></v-select-stub>
</v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub cols="10" sm="10" md="11" tag="div">
<p class="subtitle-1">
</p>
</v-col-stub>
<v-col-stub cols="2" sm="2" md="1" tag="div"><a target="_blank" href="https://github.com/WDaan/VueTorrent/releases/tag/vundefined">
<p class="mb-2"></p>
</a></v-col-stub>
</v-row-stub>
</v-list-item-stub>
<v-list-item-stub activeclass="" tag="div">
<v-row-stub tag="div" dense="true">
<v-col-stub cols="10" sm="10" md="11" tag="div">
<p class="subtitle-1">
</p>
</v-col-stub>
<v-col-stub cols="2" sm="2" md="1" tag="div"><a target="_blank" href="https://github.com/qbittorrent/qBittorrent/releases/tag/release-0">
<p class="mb-2">
0
</p>
</a></v-col-stub>
</v-row-stub>
</v-list-item-stub>
</v-card-stub>
`;