#62 Ajoute d'une configuration pour les status à considérer comme terminé

Signed-off-by: Gato <cedric@goutailler-olivier.fr>
This commit is contained in:
2026-05-30 14:43:06 +02:00
parent 43b275b064
commit 401da09f8f
21 changed files with 251 additions and 53 deletions
+24 -3
View File
@@ -80,16 +80,37 @@ describe('StatusesStore', () => {
});
});
describe('isCompleted', () => {
it('returns true for done status', () => {
expect(store.isCompleted('done')).toBe(true);
});
it('returns false for non-completed statuses', () => {
expect(store.isCompleted('draft')).toBe(false);
expect(store.isCompleted('todo')).toBe(false);
expect(store.isCompleted('in-progress')).toBe(false);
});
it('returns false for unknown status', () => {
expect(store.isCompleted('unknown')).toBe(false);
});
it('returns true for a custom status with countsAsCompleted true', () => {
store.create({ id: 'abandoned', label: 'ABANDONNÉE', bg: '#f1f5f9', color: '#64748b', countsAsCompleted: true });
expect(store.isCompleted('abandoned')).toBe(true);
});
});
describe('create', () => {
it('adds a new status with the next order value', () => {
store.create({ id: 'blocked', label: 'BLOQUÉ', bg: '#fee2e2', color: '#991b1b' });
store.create({ id: 'blocked', label: 'BLOQUÉ', bg: '#fee2e2', color: '#991b1b', countsAsCompleted: false });
const added = store.getById('blocked');
expect(added?.label).toBe('BLOQUÉ');
expect(added?.order).toBe(DEFAULT_STATUSES.length);
});
it('persists the new status to localStorage', () => {
store.create({ id: 'custom', label: 'CUSTOM', bg: '#fff', color: '#000' });
store.create({ id: 'custom', label: 'CUSTOM', bg: '#fff', color: '#000', countsAsCompleted: false });
const stored = JSON.parse(localStorage.getItem(STORAGE_KEY)!);
expect(stored.some((s: { id: string }) => s.id === 'custom')).toBe(true);
});
@@ -97,7 +118,7 @@ describe('StatusesStore', () => {
describe('update', () => {
it('updates label, bg and color of an existing status', () => {
store.update('draft', { label: 'NOUVEAU', bg: '#fff', color: '#000' });
store.update('draft', { label: 'NOUVEAU', bg: '#fff', color: '#000', countsAsCompleted: false });
const updated = store.getById('draft');
expect(updated?.label).toBe('NOUVEAU');
expect(updated?.bg).toBe('#fff');