Updated login unit test
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
parent
556caa0b1a
commit
165075aaef
|
@ -17,6 +17,10 @@ describe('Login', () => {
|
|||
vm = createWrapper(Login).vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should successfully set the token into session', async () => {
|
||||
const expectedUser = {
|
||||
id: 999,
|
||||
|
@ -42,16 +46,12 @@ describe('Login', () => {
|
|||
vm.session.destroy();
|
||||
});
|
||||
|
||||
// it('should not set the token into session if any error occurred', async () => {
|
||||
// jest.spyOn(axios, 'post').mockRejectedValue(new Error('error'));
|
||||
// jest.spyOn(vm.quasar, 'notify')
|
||||
it('should not set the token into session if any error occurred', async () => {
|
||||
jest.spyOn(axios, 'post').mockReturnValue({ data: null });
|
||||
jest.spyOn(vm.quasar, 'notify');
|
||||
|
||||
// expect(vm.session.getToken()).toEqual('');
|
||||
await vm.onSubmit();
|
||||
|
||||
// await vm.onSubmit();
|
||||
|
||||
// expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
|
||||
// { 'type': 'negative' }
|
||||
// ));
|
||||
// });
|
||||
expect(vm.quasar.notify).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue