1
- import float from './index.js' ;
2
1
import test from 'ava' ;
2
+ import float from './index.js' ;
3
3
4
4
test ( 'float return type to be number' , t => {
5
- t . is ( typeof float ( ) , 'number' ) ;
5
+ t . is ( typeof float ( ) , 'number' ) ;
6
6
} ) ;
7
7
8
8
test ( 'float with number min 0 return type to be number' , t => {
9
- t . is ( typeof float ( { min : 0 } ) , 'number' ) ;
9
+ t . is ( typeof float ( { min : 0 } ) , 'number' ) ;
10
10
} ) ;
11
11
12
12
test ( 'float with number min 0 and max 10 return type to be number' , t => {
13
- t . is ( typeof float ( { min : 0 , max : 10 } ) , 'number' ) ;
13
+ t . is ( typeof float ( { min : 0 , max : 10 } ) , 'number' ) ;
14
14
} ) ;
15
15
16
16
test ( 'float with number min 0 and max 10 less than 11' , t => {
17
- t . true ( float ( { min : 0 , max : 10 } ) < 11 ) ;
17
+ t . true ( float ( { min : 0 , max : 10 } ) < 11 ) ;
18
+ } ) ;
19
+
20
+ test ( 'float with number min 0 and max 10 and fixed 10 less than 11' , t => {
21
+ t . true ( float ( { min : 0 , max : 10 , fixed : 10 } ) < 11 ) ;
18
22
} ) ;
19
23
20
24
test ( 'float with string to thow error on string' , t => {
21
- const error = t . throws ( ( ) => {
22
- float ( { min : 'string' , max : 'string' , fixed : 'string' } )
23
- } , { instanceOf : TypeError } ) ;
25
+ const error = t . throws ( ( ) => {
26
+ // @ts -ignore
27
+ float ( { min : 'string' , max : 'string' , fixed : 'string' } ) ;
28
+ } , { instanceOf : TypeError } ) ;
24
29
25
- t . is ( error . message , 'Expected all arguments to be numbers.' ) ;
30
+ t . is ( error . message , 'Expected all arguments to be numbers.' ) ;
26
31
} ) ;
27
32
28
33
test ( 'float with min and max to thow error on min > max' , t => {
29
- const error = t . throws ( ( ) => {
30
- float ( { min : 10 , max : 0 } )
31
- } , { instanceOf : TypeError } ) ;
32
-
33
- t . is ( error . message , 'Min cannot be greater than Max.' ) ;
34
- } ) ;
34
+ const error = t . throws ( ( ) => {
35
+ float ( { min : 10 , max : 0 } ) ;
36
+ } , { instanceOf : TypeError } ) ;
37
+
38
+ t . is ( error . message , 'Min cannot be greater than Max.' ) ;
39
+ } ) ;
0 commit comments