Skip to content

Commit

Permalink
fix date test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
youngbryanyu committed Jan 16, 2024
1 parent 88ff5ec commit 9774cd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion tests/utils/envParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ describe('envParser Tests', () => {

/* Compare against expected */
expect(result instanceof Date).toBeTruthy();
expect(result.toJSON()).toBe('1969-12-31T08:00:00.000Z');
expect(result.getUTCFullYear()).toBe(1969);
expect(result.getUTCMonth()).toBe(11); // Note: Months are 0-indexed in JavaScript Dates
expect(result.getUTCDate()).toBe(31);
});
});

Expand Down
9 changes: 6 additions & 3 deletions tests/utils/typeConverter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ describe('Type Converter Util Tests', () => {

/* Compare against expected */
expect(result instanceof Date).toBeTruthy();
expect(result.toJSON()).toBe('1969-12-31T08:00:00.000Z');
});
expect(result.getUTCFullYear()).toBe(1969);
expect(result.getUTCMonth()).toBe(11); // Note: Months are 0-indexed in JavaScript Dates
expect(result.getUTCDate()).toBe(31)});

Check failure on line 119 in tests/utils/typeConverter.test.ts

View workflow job for this annotation

GitHub Actions / Lint Checks

Insert `;⏎····`

/* Test when converting to a Date is not possible */
it('Should throw an error if the input cannot be converted to a Date.', () => {
Expand Down Expand Up @@ -244,7 +245,9 @@ describe('Type Converter Util Tests', () => {
expect(result[1] instanceof Date).toBeTruthy();
expect(result[2] instanceof Date).toBeTruthy();
expect(result[0].toJSON()).toBe('1970-01-01T00:00:00.100Z');
expect(result[1].toJSON()).toBe('1969-12-31T08:00:00.000Z');
expect(result[1].getUTCFullYear()).toBe(1969);
expect(result[1].getUTCMonth()).toBe(11); // Note: Months are 0-indexed in JavaScript Dates
expect(result[1].getUTCDate()).toBe(31);
expect(result[2].toJSON()).toBe('1970-01-01T00:01:40.000Z');
});

Expand Down

0 comments on commit 9774cd2

Please sign in to comment.