coverage logout.spec.js

This commit is contained in:
Ulf Gebhardt 2021-04-25 19:52:45 +02:00
parent 45f7ece248
commit fb8b948037
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -0,0 +1,43 @@
import { mount } from '@vue/test-utils'
import Logout from './logout.vue'
const localVue = global.localVue
describe('logout.vue', () => {
let wrapper
let mocks
beforeEach(() => {
mocks = {
$t: jest.fn(),
$store: {
dispatch: jest.fn(),
},
$router: {
replace: jest.fn(),
},
}
})
describe('mount', () => {
const Wrapper = () => {
return mount(Logout, {
mocks,
localVue,
})
}
beforeEach(() => {
wrapper = Wrapper()
})
it('renders', () => {
expect(wrapper.is('div')).toBe(true)
})
it('logs out and redirects to login', () => {
expect(mocks.$store.dispatch).toBeCalledWith('auth/logout')
expect(mocks.$router.replace).toBeCalledWith('/login')
})
})
})