mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
44 lines
822 B
JavaScript
44 lines
822 B
JavaScript
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.element.tagName).toBe('DIV')
|
|
})
|
|
|
|
it('logs out and redirects to login', () => {
|
|
expect(mocks.$store.dispatch).toHaveBeenCalledWith('auth/logout')
|
|
expect(mocks.$router.replace).toHaveBeenCalledWith('/login')
|
|
})
|
|
})
|
|
})
|