Skip to content

Commit

Permalink
test(parse-duration): Fix invalid input handling in parseDuration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Jan 16, 2024
1 parent 8bbbbb6 commit a2ced14
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/parse-duration/src/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ describe('@alwatr/parse-duration', () => {
});

it('should throw error for invalid duration', () => {
// @ts-expect-error testing invalid input
expect(() => parseDuration('1x')).toThrow('invalid_unit');
});

it('should throw error for invalid conversion unit', () => {
// @ts-expect-error testing invalid input
expect(() => parseDuration('1h', 'x')).toThrow('invalid_unit');
});

it('should throw error for non-numeric duration', () => {
// @ts-expect-error testing invalid input
expect(() => parseDuration('xh')).toThrow('not_a_number');
});
});

0 comments on commit a2ced14

Please sign in to comment.