mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
coverage logout.spec.js
This commit is contained in:
parent
45f7ece248
commit
fb8b948037
43
webapp/pages/logout.spec.js
Normal file
43
webapp/pages/logout.spec.js
Normal 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')
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user