disable warnings of bootstrap-vue in tests, network-only fetchPolicy in Login, testsing tabs of TransactionsLists

This commit is contained in:
Moriz Wahl 2021-08-17 17:37:37 +02:00
parent e0b31a8e4d
commit 3c4c0bf844
4 changed files with 46 additions and 14 deletions

View File

@ -88,6 +88,7 @@ export default {
email: this.form.email,
password: this.form.password,
},
fetchPolicy: 'network-only',
})
.then((result) => {
const {

View File

@ -3,16 +3,6 @@ import UserProfileTransactionList from './UserProfileTransactionList'
const localVue = global.localVue
const mutationObserverMock = jest.fn(function MutationObserver(callback) {
this.observe = jest.fn()
this.disconnect = jest.fn()
this.trigger = (mockedMutationsList) => {
callback(mockedMutationsList, this)
}
})
global.MutationObserver = mutationObserverMock
describe('UserProfileTransactionList', () => {
let wrapper
@ -33,7 +23,7 @@ describe('UserProfileTransactionList', () => {
const stubs = {
GdtTransactionList: true,
}
const Wrapper = () => {
return mount(UserProfileTransactionList, { localVue, mocks, stubs })
}
@ -65,5 +55,43 @@ describe('UserProfileTransactionList', () => {
it('renders the transaction gradido transform table', () => {
expect(wrapper.findComponent({ name: 'GdtTransactionList' }).exists()).toBeTruthy()
})
describe('tabs', () => {
it('shows the GDD transactions by default', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(0).isVisible()).toBeTruthy()
})
it('does not show the GDT transactions by default', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(1).isVisible()).toBeFalsy()
})
describe('click on GDT tab', () => {
beforeEach(() => {
wrapper.findAll('li[ role="presentation"]').at(1).find('a').trigger('click')
})
it('does not show the GDD transactions', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(0).isVisible()).toBeFalsy()
})
it('shows the GDT transactions', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(1).isVisible()).toBeTruthy()
})
describe('click on GDD tab', () => {
beforeEach(() => {
wrapper.findAll('li[ role="presentation"]').at(0).find('a').trigger('click')
})
it('shows the GDD transactions', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(0).isVisible()).toBeTruthy()
})
it('does not show the GDT', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(1).isVisible()).toBeFalsy()
})
})
})
})
})
})

View File

@ -33,6 +33,9 @@ loadAllRules(i18nMock)
global.localVue = createLocalVue()
// switch of warnings from bootstrap vue
global.process.env.BOOTSTRAP_VUE_NO_WARN = true
global.localVue.use(BootstrapVue)
global.localVue.use(Vuex)
global.localVue.use(IconsPlugin)

View File

@ -3750,9 +3750,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001181:
version "1.0.30001191"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001191.tgz#bacb432b6701f690c8c5f7c680166b9a9f0843d9"
integrity sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw==
version "1.0.30001251"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz"
integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==
capture-exit@^2.0.0:
version "2.0.0"