Ajout des tests

This commit is contained in:
2026-05-23 20:18:18 +02:00
parent 5b5edbb3da
commit 80f8b56ec4
10 changed files with 1222 additions and 9 deletions
+29 -1
View File
@@ -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);
});
});