import { describe, expect, it } from 'vitest'; import { Client } from '../../src/domain/client.js'; describe('Client', () => { it('cree un client valide', () => { const c = new Client({ id: 1, nom: 'Acme' }); expect(c.statut).toBe('prospect'); expect(c.projets.length).toBe(0); }); it('creerProjet cas nominal', () => { const c = new Client({ id: 1, nom: 'Acme' }); const p = c.creerProjet('Site corpo', 100); expect(p.id).toBe(100); expect(p.clientId).toBe(1); expect(c.projets.length).toBe(1); }); it('creerProjet throw si nom duplique', () => { const c = new Client({ id: 1, nom: 'Acme' }); c.creerProjet('Site corpo', 100); expect(() => c.creerProjet('Site corpo', 101)).toThrow(/existe deja/); }); it('creerProjet bloque si client archive', () => { const c = new Client({ id: 1, nom: 'Acme' }); c.archiver(); expect(() => c.creerProjet('X', 1)).toThrow(/archive/); }); it('archiver transition', () => { const c = new Client({ id: 1, nom: 'Acme' }); c.archiver(); expect(c.statut).toBe('archive'); }); });