1 | import { CalendarDay, CalendarMonth, CalendarWeek } from "../classes";
|
2 |
|
3 | import { getWeeks } from "./getWeeks";
|
4 |
|
5 | const days1 = [
|
6 | new CalendarDay(new Date(2023, 1, 12), new Date(2023, 1, 1)),
|
7 | new CalendarDay(new Date(2023, 1, 13), new Date(2023, 1, 1))
|
8 | ];
|
9 | const days2 = [
|
10 | new CalendarDay(new Date(2023, 1, 13), new Date(2023, 1, 1)),
|
11 | new CalendarDay(new Date(2023, 1, 14), new Date(2023, 1, 1))
|
12 | ];
|
13 | const days3 = [
|
14 | new CalendarDay(new Date(2023, 2, 12), new Date(2023, 2, 1)),
|
15 | new CalendarDay(new Date(2023, 2, 13), new Date(2023, 2, 1))
|
16 | ];
|
17 | const days4 = [
|
18 | new CalendarDay(new Date(2023, 2, 13), new Date(2023, 2, 1)),
|
19 | new CalendarDay(new Date(2023, 2, 14), new Date(2023, 2, 1))
|
20 | ];
|
21 | const weeks1 = [new CalendarWeek(1, days1), new CalendarWeek(2, days2)];
|
22 | const weeks2 = [new CalendarWeek(3, days3), new CalendarWeek(4, days4)];
|
23 | const months = [
|
24 | new CalendarMonth(days1[0].date, weeks1),
|
25 | new CalendarMonth(days1[0].date, weeks2)
|
26 | ];
|
27 |
|
28 | it("should return all the days belonging to the calendar by merging the days in the weeks for each month", () => {
|
29 | expect(getWeeks(months)).toEqual([...weeks1, ...weeks2]);
|
30 | });
|