-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Thank you for creating a wonderful calendar library.
It is very helpful.
Currently, the test does not pass in my environment.
$ yarn test
...
...
...
viewOfInterval()
✓ returns a day interval for day view (2ms)
✓ returns a week interval for week view (2ms)
✕ returns a month interval for month view (7ms)
✓ returns a year interval for year view (30ms)
viewOfDays()
✕ returns day intervals for view and datetime (5ms)
...
...
...
● viewOfInterval() › returns a month interval for month view
expect(received).toBe(expected) // Object.is equality
Expected: 31
Received: 42
87 | const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
88 | const interval = viewOfInterval(datetime, 'months');
> 89 | expect(numUnit(interval, 'days')).toBe(31);
| ^
90 | expect(interval.start.day).toBe(1);
91 | expect(interval.end.day).toBe(31);
92 | });
at Object.<anonymous> (test/calx.test.tsx:89:39)
● viewOfDays() › returns day intervals for view and datetime
expect(received).toBe(expected) // Object.is equality
Expected: 31
Received: 42
108 | const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
109 | const days = viewOfDays(datetime, 'month');
> 110 | expect(days.length).toBe(31);
| ^
111 | expect(days[0].start.day).toBe(1);
112 | expect(days[30].start.day).toBe(31);
113 | });
at Object.<anonymous> (test/calx.test.tsx:110:25)
...
...
...
Test Suites: 1 failed, 1 total
Tests: 2 failed, 19 passed, 21 total
Snapshots: 0 total
Time: 2.416s, estimated 4sAfter looking at the code, I have a few questions.
When do you need the logic for paddedMonthOf()?
It's called in viewOfInterval(), but monthOf(datetime) looks fine to me. In fact, when I rewrote it to monthOf(datetime), the test passed.
Lines 108 to 109 in cc261df
| case 'months': | |
| return paddedMonthOf(datetime, { daysPerWeek: 7, weeksPerMonth: 6 }); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels