Ajoute date debut et date de fin
Signed-off-by: Gato <cedric@goutailler-olivier.fr>
This commit is contained in:
@@ -10,6 +10,8 @@ const makeIssue = (overrides: Partial<IssueEntity> = {}): IssueEntity => ({
|
||||
assignee: '',
|
||||
epic: '',
|
||||
name: 'Test Issue',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
dueDate: '',
|
||||
description: '',
|
||||
estimatedTime: null,
|
||||
@@ -156,6 +158,31 @@ describe('IssuesStore', () => {
|
||||
await p;
|
||||
expect(store.getById(994)?.estimatedTime).toBeNull();
|
||||
});
|
||||
|
||||
it('defaults startDate to empty string when missing in API response', async () => {
|
||||
const issue = { ...makeIssue({ id: 0 }), startDate: undefined } as any;
|
||||
const p = store.upsert(issue);
|
||||
httpMock.expectOne({ method: 'POST', url: `${API_BASE_URL}/issues` }).flush({ ...makeIssue({ id: 993 }), startDate: undefined });
|
||||
await p;
|
||||
expect(store.getById(993)?.startDate).toBe('');
|
||||
});
|
||||
|
||||
it('defaults endDate to empty string when missing in API response', async () => {
|
||||
const issue = { ...makeIssue({ id: 0 }), endDate: undefined } as any;
|
||||
const p = store.upsert(issue);
|
||||
httpMock.expectOne({ method: 'POST', url: `${API_BASE_URL}/issues` }).flush({ ...makeIssue({ id: 992 }), endDate: undefined });
|
||||
await p;
|
||||
expect(store.getById(992)?.endDate).toBe('');
|
||||
});
|
||||
|
||||
it('preserves startDate and endDate when provided', async () => {
|
||||
const issue = makeIssue({ id: 0, startDate: '2026-01-01', endDate: '2026-01-31' });
|
||||
const p = store.upsert(issue);
|
||||
httpMock.expectOne({ method: 'POST', url: `${API_BASE_URL}/issues` }).flush(makeIssue({ id: 991, startDate: '2026-01-01', endDate: '2026-01-31' }));
|
||||
await p;
|
||||
expect(store.getById(991)?.startDate).toBe('2026-01-01');
|
||||
expect(store.getById(991)?.endDate).toBe('2026-01-31');
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteById', () => {
|
||||
|
||||
Reference in New Issue
Block a user