forked from Ivasoft/geovisio-website
fix router guards
This commit is contained in:
@@ -44,16 +44,23 @@ describe('Template', () => {
|
||||
}
|
||||
}
|
||||
})
|
||||
expect(wrapper.html()).contains('path="api/auth/login')
|
||||
expect(wrapper.html()).contains('api/auth/login')
|
||||
})
|
||||
})
|
||||
describe('When the user is logged', () => {
|
||||
it('should render the component with good wording keys', async () => {
|
||||
Object.defineProperty(document, 'cookie', {
|
||||
value: 'user_id=abc123'
|
||||
})
|
||||
vi.mock('vue3-cookies', () => ({
|
||||
useCookies: vi.fn(() => ({
|
||||
cookies: {
|
||||
get: vi.fn(() => 'abc123') // Mock the cookies.get method
|
||||
}
|
||||
}))
|
||||
}))
|
||||
vi.resetModules()
|
||||
import.meta.env.VITE_API_URL = 'api-url/'
|
||||
const computed = {
|
||||
isLogged: () => true
|
||||
}
|
||||
const wrapper = shallowMount(Header, {
|
||||
props: {
|
||||
authEnabled: true,
|
||||
@@ -64,8 +71,10 @@ describe('Template', () => {
|
||||
mocks: {
|
||||
$t: (msg) => msg
|
||||
}
|
||||
}
|
||||
},
|
||||
computed
|
||||
})
|
||||
console.log(wrapper.html())
|
||||
expect(wrapper.html()).contains('general.header.contribute_text')
|
||||
expect(wrapper.html()).contains('general.header.my_information_text')
|
||||
expect(wrapper.html()).contains('general.header.logout_text')
|
||||
|
||||
@@ -49,7 +49,6 @@ describe('Template', () => {
|
||||
|
||||
expect(axios.get).toHaveBeenCalledWith('api/users/me/tokens')
|
||||
expect(wrapper.vm.userTokens).toEqual(mockResponseTokens)
|
||||
console.log('HTML', wrapper.html())
|
||||
expect(wrapper.html()).contains('•••••••••••••••••••••••••••••••')
|
||||
expect(wrapper.html()).contains('icon="bi bi-eye"')
|
||||
expect(wrapper.html()).contains('look="button--rounded"')
|
||||
|
||||
Reference in New Issue
Block a user