Refactors layout engine tests to use arrays

Updates tests to use arrays instead of Maps for storing layouts.
This simplifies the data structures and allows for more straightforward assertions.
This commit is contained in:
Janus C. H. Knudsen 2025-09-28 13:45:15 +02:00
parent 6ccc071587
commit 7fc401b1df
2 changed files with 20 additions and 22 deletions

View file

@ -18,26 +18,24 @@ describe('AllDayManager - Manager Functionality', () => {
const layouts = allDayManager.calculateAllDayEventsLayout([event], weekDates);
expect(layouts.size).toBe(1);
expect(layouts.has('test')).toBe(true);
const layout = layouts.get('test');
expect(layout?.startColumn).toBe(3); // Sept 24 is column 3
expect(layout?.row).toBe(1);
expect(layouts.length).toBe(1);
expect(layouts[0].calenderEvent.id).toBe('test');
expect(layouts[0].startColumn).toBe(3); // Sept 24 is column 3
expect(layouts[0].row).toBe(1);
});
it('should handle empty event list', () => {
const weekDates = ['2024-09-22', '2024-09-23', '2024-09-24', '2024-09-25', '2024-09-26'];
const layouts = allDayManager.calculateAllDayEventsLayout([], weekDates);
expect(layouts.size).toBe(0);
expect(layouts.length).toBe(0);
});
it('should handle empty week dates', () => {
const event = createMockEvent('test', 'Test Event', '2024-09-24', '2024-09-24');
const layouts = allDayManager.calculateAllDayEventsLayout([event], []);
expect(layouts.size).toBe(0);
expect(layouts.length).toBe(0);
});
});
});