Ajout des tests
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { Projects } from './projects';
|
||||
|
||||
describe('Projects', () => {
|
||||
@@ -19,4 +18,33 @@ describe('Projects', () => {
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should have 3 default projects', () => {
|
||||
expect((component as any).projects().length).toBe(3);
|
||||
});
|
||||
|
||||
it('createProject adds a new project', () => {
|
||||
(component as any).createProject();
|
||||
expect((component as any).projects().length).toBe(4);
|
||||
});
|
||||
|
||||
it('createProject increments the id each time', () => {
|
||||
(component as any).createProject();
|
||||
(component as any).createProject();
|
||||
const projects = (component as any).projects();
|
||||
expect(projects[3].id).toBe(4);
|
||||
expect(projects[4].id).toBe(5);
|
||||
});
|
||||
|
||||
it('new project starts with Nouveau status', () => {
|
||||
(component as any).createProject();
|
||||
const newProject = (component as any).projects()[3];
|
||||
expect(newProject.status).toBe('Nouveau');
|
||||
});
|
||||
|
||||
it('new project starts with 0 progress', () => {
|
||||
(component as any).createProject();
|
||||
const newProject = (component as any).projects()[3];
|
||||
expect(newProject.progress).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user