Skip to content
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

Make tests locale independent (#2592) #2593

Merged
merged 2 commits into from
Dec 13, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { Month } from '../constants';
import { newUTC } from '../newUTC';

import { getDaysInUTCMonth } from '.';

describe('packages/date-utils/getDaysInUTCMonth', () => {
test('returns the number of days in the month', () => {
const result = getDaysInUTCMonth(new Date(2100, 1 /* Feb */, 11));
const result = getDaysInUTCMonth(newUTC(2100, Month.February, 11));
expect(result).toEqual(28);
});

test('when given the 1st of the month', () => {
const result = getDaysInUTCMonth(new Date(2100, 1 /* Feb */, 1));
const result = getDaysInUTCMonth(newUTC(2100, Month.February, 1));
expect(result).toEqual(28);
});

test('when given the last of the month', () => {
const result = getDaysInUTCMonth(new Date(2100, 1 /* Feb */, 28));
const result = getDaysInUTCMonth(newUTC(2100, Month.February, 28));
expect(result).toEqual(28);
});

test('when given February of a leap year', () => {
const result = getDaysInUTCMonth(new Date(2000, 1 /* Feb */, 1));
const result = getDaysInUTCMonth(newUTC(2000, Month.February, 1));
expect(result).toEqual(29);
});

Expand Down
Loading