File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
tests/validation/drivers/validators Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,16 @@ describe("isNumber", () => {
10
10
expect ( isNumber ( 123456789 ) ) . to . equal ( 123456789 )
11
11
} )
12
12
13
+ it ( "should parse a string containing a number into a number" , ( ) => {
14
+ expect ( isNumber ( "1" ) ) . to . equal ( 1 )
15
+ expect ( isNumber ( "0" ) ) . to . equal ( 0 )
16
+ expect ( isNumber ( "0.001" ) ) . to . equal ( 0.001 )
17
+ expect ( isNumber ( "-12423435.1" ) ) . to . equal ( - 12423435.1 )
18
+ expect ( isNumber ( "+100" ) ) . to . equal ( 100 )
19
+ } )
20
+
13
21
it ( "should return a validation error if input is not a number" , ( ) => {
14
22
expectToThrowCustomClass ( ( ) => isNumber ( { } ) , ValidationError )
15
- expectToThrowCustomClass ( ( ) => isNumber ( "1" ) , ValidationError )
16
- expectToThrowCustomClass ( ( ) => isNumber ( "0" ) , ValidationError )
17
23
expectToThrowCustomClass ( ( ) => isNumber ( "das" ) , ValidationError )
18
24
expectToThrowCustomClass ( ( ) => isNumber ( "true" ) , ValidationError )
19
25
expectToThrowCustomClass ( ( ) => isNumber ( "false" ) , ValidationError )
You can’t perform that action at this time.
0 commit comments