Skip to content

Commit

Permalink
Add tests for isNumeric
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Sep 7, 2022
1 parent ed8aa33 commit a6ca338
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/block-library/src/navigation/edit/test/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Internal dependencies
*/
import { isNumeric } from '../utils';

describe( 'isNumeric', () => {
it.each( [
[ 42, true ],
[ '42', true ],
[ ' 42 ', true ],
[ '', false ],
[ 'some-slug', false ],
[ 'some-42-slug-with-trailing-number-42', false ],
[ '42-some-42-slug-with-leading-number', false ],
[ NaN, false ],
[ Infinity, false ],
] )(
'correctly determines variable type for "%s"',
( candidate, expected ) => {
expect( isNumeric( candidate ) ).toBe( expected );
}
);
} );

0 comments on commit a6ca338

Please sign in to comment.