front unit test fixed after login enhancement
This commit is contained in:
parent
9a9bcc5e51
commit
20604a2441
|
@ -12,7 +12,7 @@ jest.mock('vue-router', () => ({
|
|||
|
||||
describe('UserPanel', () => {
|
||||
describe('onMounted', () => {
|
||||
it('should define the user into state', async () => {
|
||||
it.only('should define the user into state', async () => {
|
||||
const userMock = {
|
||||
user: {
|
||||
id: 1,
|
||||
|
@ -30,7 +30,7 @@ describe('UserPanel', () => {
|
|||
expect(vm.state.getUser().value).toEqual(expectedUser);
|
||||
});
|
||||
|
||||
xit('should logout and notify the expected error', async () => {
|
||||
it('should logout and notify the expected error', async () => {
|
||||
jest.spyOn(axios, 'get').mockRejectedValue(new Error('error'));
|
||||
|
||||
const { vm } = createWrapper(UserPanel);
|
||||
|
|
|
@ -7,6 +7,7 @@ const mockPush = jest.fn();
|
|||
jest.mock('vue-router', () => ({
|
||||
useRouter: () => ({
|
||||
push: mockPush,
|
||||
currentRoute: { value: 'myCurrentRoute' }
|
||||
}),
|
||||
}));
|
||||
|
||||
|
@ -18,6 +19,7 @@ describe('Login', () => {
|
|||
|
||||
it('should successfully set the token into session', async () => {
|
||||
jest.spyOn(axios, 'post').mockResolvedValue({ data: { token: 'token' } });
|
||||
jest.spyOn(axios, 'get').mockResolvedValue({ data: { roles: [], user: { id: 1 } } });
|
||||
jest.spyOn(vm.quasar, 'notify')
|
||||
|
||||
expect(vm.session.getToken()).toEqual('');
|
||||
|
|
Loading…
Reference in New Issue