Updated login unit test
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-08-08 12:31:01 +02:00
parent 556caa0b1a
commit 165075aaef
1 changed files with 10 additions and 10 deletions

View File

@ -17,6 +17,10 @@ describe('Login', () => {
vm = createWrapper(Login).vm; vm = createWrapper(Login).vm;
}); });
afterEach(() => {
jest.clearAllMocks();
});
it('should successfully set the token into session', async () => { it('should successfully set the token into session', async () => {
const expectedUser = { const expectedUser = {
id: 999, id: 999,
@ -42,16 +46,12 @@ describe('Login', () => {
vm.session.destroy(); vm.session.destroy();
}); });
// it('should not set the token into session if any error occurred', async () => { it('should not set the token into session if any error occurred', async () => {
// jest.spyOn(axios, 'post').mockRejectedValue(new Error('error')); jest.spyOn(axios, 'post').mockReturnValue({ data: null });
// jest.spyOn(vm.quasar, 'notify') jest.spyOn(vm.quasar, 'notify');
// expect(vm.session.getToken()).toEqual(''); await vm.onSubmit();
// await vm.onSubmit(); expect(vm.quasar.notify).not.toHaveBeenCalled();
});
// expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
// { 'type': 'negative' }
// ));
// });
}); });