expect('123').toBeNumericString();
See original GitHub issueexpect('123').toBeNumericString();
expect('1,234,567.00').toBeNumericString();
expect(' 123 ').not.toBeNumericString();
expect('1..0').not.toBeNumericString();
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Test if object, array or string. · Issue #3457 · facebook/jest
Is there a way to check if a component is an object, array or string? This would be similar to chai's 'should.be.a' Ex.:...
Read more >Test for numeric elements in a character string - Stack Overflow
numeric() from package varhandle. The function accepts the following arguments: v The character vector or factor vector. (Mandatory). na.rm ...
Read more >Namespace: matchers - Jasmine Documentation
expect the actual value to be greater than or equal to the expected value. Parameters: Name, Type, Description. expected, Number. The expected value...
Read more >Type Conversions - The Modern JavaScript Tutorial
Explicit conversion is usually required when we read a value from a string-based source like a text form but expect a number to...
Read more >parseInt() - JavaScript - MDN Web Docs
The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No problem, I understand it’s not the most reliable thing that can be tested for.
Sorry about this @jacobwarduk but similar to https://github.com/JamieMason/Jasmine-Matchers/issues/38#issuecomment-274784848, I’ve decided not to include this matcher (even though I created the issue in the first place).
Knowing more about it now, I worry there could be too many edge cases and because people depend on this library for their tests, I want it to be totally dependable so people can have confidence in it and their tests. This matcher might be a little risky.
Thanks a lot for your work on this Jacob, sorry to have wasted your time.