Ajout diagram de gantt
This commit is contained in:
@@ -31,6 +31,8 @@ const makeMilestone = (overrides: Partial<MilestoneEntity> = {}): MilestoneEntit
|
||||
id: 1,
|
||||
name: 'Sprint 1',
|
||||
description: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
dueDate: '',
|
||||
issueIds: [],
|
||||
...overrides,
|
||||
@@ -275,6 +277,46 @@ describe('MilestoneDetail', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('milestoneGanttTasks', () => {
|
||||
it('returns empty array when no linked issues', () => {
|
||||
issuesStore.seed([]);
|
||||
(component as any).milestone.issueIds = [];
|
||||
expect((component as any).milestoneGanttTasks).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('excludes issues missing startDate or endDate', () => {
|
||||
issuesStore.seed([
|
||||
makeIssue({ id: 1, startDate: '2025-01-01', endDate: '' }),
|
||||
makeIssue({ id: 2, startDate: '', endDate: '2025-01-31' }),
|
||||
]);
|
||||
(component as any).milestone.issueIds = [1, 2];
|
||||
expect((component as any).milestoneGanttTasks).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('returns a task for each issue with both dates', () => {
|
||||
issuesStore.seed([
|
||||
makeIssue({ id: 1, name: 'Task A', startDate: '2025-01-01', endDate: '2025-01-15', progress: 50 }),
|
||||
makeIssue({ id: 2, name: 'Task B', startDate: '2025-01-10', endDate: '2025-01-31', progress: 0 }),
|
||||
]);
|
||||
(component as any).milestone.issueIds = [1, 2];
|
||||
const tasks = (component as any).milestoneGanttTasks;
|
||||
expect(tasks).toHaveLength(2);
|
||||
expect(tasks[0]).toMatchObject({ id: 'issue-1', name: '#1 Task A', start: '2025-01-01', end: '2025-01-15', progress: 50 });
|
||||
expect(tasks[1]).toMatchObject({ id: 'issue-2', name: '#2 Task B', start: '2025-01-10', end: '2025-01-31', progress: 0 });
|
||||
});
|
||||
|
||||
it('only includes issues linked to the milestone', () => {
|
||||
issuesStore.seed([
|
||||
makeIssue({ id: 1, startDate: '2025-01-01', endDate: '2025-01-31' }),
|
||||
makeIssue({ id: 2, startDate: '2025-02-01', endDate: '2025-02-28' }),
|
||||
]);
|
||||
(component as any).milestone.issueIds = [1];
|
||||
const tasks = (component as any).milestoneGanttTasks;
|
||||
expect(tasks).toHaveLength(1);
|
||||
expect(tasks[0].id).toBe('issue-1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('issueSuggestions', () => {
|
||||
beforeEach(() => {
|
||||
issuesStore.seed([
|
||||
|
||||
Reference in New Issue
Block a user