mise en place des tests et test de workflows
This commit is contained in:
@@ -21,6 +21,7 @@ describe('LoginComponent', () => {
|
||||
mockToastrService = {
|
||||
warning: jest.fn(),
|
||||
success: jest.fn(),
|
||||
info: jest.fn(),
|
||||
error: jest.fn()
|
||||
};
|
||||
|
||||
@@ -41,6 +42,11 @@ describe('LoginComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// si le composant instancie subscriptions/timers
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
@@ -79,9 +85,9 @@ describe('LoginComponent', () => {
|
||||
|
||||
await component.login({email: 'fail@test.com', password: 'fail'});
|
||||
|
||||
expect(mockToastrService.warning).toHaveBeenCalledWith(
|
||||
expect(mockToastrService.info).toHaveBeenCalledWith(
|
||||
'Vous devez vérifier votre adresse e-mail avant de vous connecter.',
|
||||
'Erreur de connexion',
|
||||
'Information de connexion',
|
||||
{
|
||||
closeButton: true,
|
||||
progressAnimation: 'decreasing',
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
import { setupZoneTestEnv } from "jest-preset-angular/setup-env/zone";
|
||||
import * as fetch from 'node-fetch';
|
||||
|
||||
(global as any).fetch = fetch;
|
||||
(global as any).Headers = fetch.Headers;
|
||||
(global as any).Request = fetch.Request;
|
||||
(global as any).Response = fetch.Response;
|
||||
|
||||
setupZoneTestEnv();
|
||||
|
||||
Reference in New Issue
Block a user