Skip to content

Commit

Permalink
Add more test cases for converting to ms (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmolens committed Dec 2, 2021
1 parent 1304f15 commit 40fdbd5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ describe('ms(string)', function () {
expect(ms('100ms')).toBe(100);
});

it('should convert y to ms', function () {
expect(ms('1y')).toBe(31557600000);
});

it('should work with decimals', function () {
expect(ms('1.5h')).toBe(5400000);
});
Expand Down Expand Up @@ -105,6 +109,14 @@ describe('ms(long string)', function () {
expect(ms('2 days')).toBe(172800000);
});

it('should convert weeks to ms', function () {
expect(ms('1 week')).toBe(604800000);
});

it('should convert years to ms', function () {
expect(ms('1 year')).toBe(31557600000);
});

it('should work with decimals', function () {
expect(ms('1.5 hours')).toBe(5400000);
});
Expand Down

0 comments on commit 40fdbd5

Please sign in to comment.