Skip to content

Commit

Permalink
Add test cases for empty string checks for isNumeric
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinika committed Dec 4, 2024
1 parent 8f727b3 commit f894ed1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/node-unit/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ describe('utils', function () {
it('returns false for a string that cannot be parsed as a number', function () {
expect(utils.isNumeric('foo'), 'to equal', false);
});
it('returns false for empty string', function () {
expect(utils.isNumeric(''), 'to equal', false);
});
it('returns false for empty string with many whitespaces', function () {
expect(utils.isNumeric(' '), 'to equal', false);
});
it('returns true for stringified zero', function () {
expect(utils.isNumeric('0'), 'to equal', true);
});
});
});
});

0 comments on commit f894ed1

Please sign in to comment.