Skip to content

Commit

Permalink
test(convertdate): fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed May 6, 2021
1 parent b857efe commit 8c780b3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/conditionOperators/date/convertDate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ import { convertDate } from './convertDate';
describe('convertDate', () => {
describe('when passing a Date instance', () => {
it('returns time in milliseconds', () => {
expect(convertDate(new Date('December 17, 1995 03:24:00'))).toBe(819188640000);
expect(convertDate(new Date('December 18, 1995 03:24:00'))).toBe(819275040000);
const date1 = new Date('December 17, 1995 03:24:00');
const date2 = new Date('December 18, 1995 03:24:00');

expect(convertDate(date1)).toBe(date1.getTime());
expect(convertDate(date2)).toBe(date2.getTime());
});
});

describe('when passing a string', () => {
it('returns time in milliseconds', () => {
expect(convertDate('December 17, 1995 03:24:00')).toBe(819188640000);
expect(convertDate('December 15, 1991 03:24:00')).toBe(692785440000);
it('returns time in milliseconds', () => {
const date1 = new Date('December 17, 1995 03:24:00');
const date2 = new Date('December 15, 1991 03:24:00');

expect(convertDate(date1.toISOString())).toBe(date1.getTime());
expect(convertDate(date2.toISOString())).toBe(date2.getTime());
});
});
});
});

0 comments on commit 8c780b3

Please sign in to comment.