Ajoute date debut et date de fin
Signed-off-by: Gato <cedric@goutailler-olivier.fr>
This commit is contained in:
@@ -14,6 +14,8 @@ const makeIssue = (overrides: Partial<IssueEntity> = {}): IssueEntity => ({
|
||||
assignee: '',
|
||||
epic: '',
|
||||
name: 'Test Issue',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
dueDate: '',
|
||||
description: '',
|
||||
estimatedTime: null,
|
||||
@@ -213,6 +215,86 @@ describe('IssueDetail — existing issue', () => {
|
||||
(component as any).saveIssue();
|
||||
expect(store.issues().length).toBe(countBefore);
|
||||
});
|
||||
|
||||
it('does not persist when dateValidationError is set', async () => {
|
||||
(component as any).issue.name = 'Has Dates';
|
||||
(component as any).issue.startDate = '2026-02-01';
|
||||
(component as any).issue.endDate = '2026-01-01';
|
||||
await (component as any).saveIssue();
|
||||
expect(store.getById(1)?.name).not.toBe('Has Dates');
|
||||
});
|
||||
});
|
||||
|
||||
describe('dateValidationError', () => {
|
||||
it('returns null when both dates are empty', () => {
|
||||
(component as any).issue.startDate = '';
|
||||
(component as any).issue.endDate = '';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null when only startDate is set', () => {
|
||||
(component as any).issue.startDate = '2026-01-01';
|
||||
(component as any).issue.endDate = '';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null when only endDate is set', () => {
|
||||
(component as any).issue.startDate = '';
|
||||
(component as any).issue.endDate = '2026-01-31';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null when startDate equals endDate', () => {
|
||||
(component as any).issue.startDate = '2026-01-15';
|
||||
(component as any).issue.endDate = '2026-01-15';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null when startDate is before endDate', () => {
|
||||
(component as any).issue.startDate = '2026-01-01';
|
||||
(component as any).issue.endDate = '2026-01-31';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns an error when startDate is after endDate', () => {
|
||||
(component as any).issue.startDate = '2026-02-01';
|
||||
(component as any).issue.endDate = '2026-01-01';
|
||||
expect((component as any).dateValidationError).toContain('supérieure à la date de fin');
|
||||
});
|
||||
|
||||
it('returns null when dependency has no endDate and startDate is set', async () => {
|
||||
store.upsert(makeIssue({ id: 10, startDate: '2026-01-01', endDate: '' }));
|
||||
(component as any).issue.dependsOnIds = [10];
|
||||
(component as any).issue.startDate = '2025-12-01';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns an error when startDate is before dependency endDate (Finish-to-Start)', async () => {
|
||||
store.upsert(makeIssue({ id: 10, endDate: '2026-02-01' }));
|
||||
(component as any).issue.dependsOnIds = [10];
|
||||
(component as any).issue.startDate = '2026-01-15';
|
||||
expect((component as any).dateValidationError).toContain('#10');
|
||||
});
|
||||
|
||||
it('returns null when startDate equals dependency endDate', async () => {
|
||||
store.upsert(makeIssue({ id: 10, endDate: '2026-02-01' }));
|
||||
(component as any).issue.dependsOnIds = [10];
|
||||
(component as any).issue.startDate = '2026-02-01';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null when startDate is after dependency endDate', async () => {
|
||||
store.upsert(makeIssue({ id: 10, endDate: '2026-02-01' }));
|
||||
(component as any).issue.dependsOnIds = [10];
|
||||
(component as any).issue.startDate = '2026-02-15';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null when there are no dependencies', () => {
|
||||
(component as any).issue.dependsOnIds = [];
|
||||
(component as any).issue.startDate = '2026-01-01';
|
||||
expect((component as any).dateValidationError).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteIssue', () => {
|
||||
|
||||
Reference in New Issue
Block a user