Skip to content

Fixed the test code #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test/calx.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,19 @@ describe('viewOfInterval()', () => {
expect(interval.end.month).toBe(1);
expect(interval.end.day).toBe(4);
});
it('returns a month interval for month view', () => {
it('returns a month interval for month view (2019.12.30)', () => {
const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
const interval = viewOfInterval(datetime, 'months');
expect(numUnit(interval, 'days')).toBe(31);
expect(numUnit(interval, 'days')).toBe(42);
expect(interval.start.day).toBe(1);
expect(interval.end.day).toBe(31);
expect(interval.end.day).toBe(11);
});
it('returns a month interval for month view (2020.12.30)', () => {
const datetime = DateTime.fromObject({ year: 2020, month: 12, day: 30 });
const interval = viewOfInterval(datetime, 'months');
expect(numUnit(interval, 'days')).toBe(42);
expect(interval.start.day).toBe(29);
expect(interval.end.day).toBe(9);
});
it('returns a year interval for year view', () => {
const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
Expand All @@ -107,7 +114,7 @@ describe('viewOfDays()', () => {
it('returns day intervals for view and datetime', () => {
const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
const days = viewOfDays(datetime, 'month');
expect(days.length).toBe(31);
expect(days.length).toBe(42);
expect(days[0].start.day).toBe(1);
expect(days[30].start.day).toBe(31);
});
Expand Down