Increase coverage in admin interface

This commit is contained in:
Wolfgang Huß 2022-10-12 17:38:17 +02:00
parent cb0e044fb4
commit b75b822d10
2 changed files with 12 additions and 10 deletions

View File

@ -3,11 +3,15 @@ import NavBar from './NavBar.vue'
const localVue = global.localVue
const apolloMutateMock = jest.fn()
const storeDispatchMock = jest.fn()
const routerPushMock = jest.fn()
const mocks = {
$t: jest.fn((t) => t),
$apollo: {
mutate: apolloMutateMock,
},
$store: {
state: {
openCreations: 1,
@ -69,5 +73,9 @@ describe('NavBar', () => {
it('dispatches logout to store', () => {
expect(storeDispatchMock).toBeCalledWith('logout')
})
it('has called logout mutation', () => {
expect(apolloMutateMock).toBeCalled()
})
})
})

View File

@ -36,16 +36,10 @@ export default {
async logout() {
window.location.assign(CONFIG.WALLET_URL)
// window.location = CONFIG.WALLET_URL
this.$apollo
.mutate({
mutation: logout,
})
.then(() => {
this.$store.dispatch('logout')
})
.catch(() => {
this.$store.dispatch('logout')
})
this.$store.dispatch('logout')
await this.$apollo.mutate({
mutation: logout,
})
},
wallet() {
window.location = CONFIG.WALLET_AUTH_URL.replace('{token}', this.$store.state.token)