1- import float from './index.js' ;
21import test from 'ava' ;
2+ import float from './index.js' ;
33
44test ( 'float return type to be number' , t => {
5- t . is ( typeof float ( ) , 'number' ) ;
5+ t . is ( typeof float ( ) , 'number' ) ;
66} ) ;
77
88test ( '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' ) ;
1010} ) ;
1111
1212test ( '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' ) ;
1414} ) ;
1515
1616test ( '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 ) ;
1822} ) ;
1923
2024test ( '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 } ) ;
2429
25- t . is ( error . message , 'Expected all arguments to be numbers.' ) ;
30+ t . is ( error . message , 'Expected all arguments to be numbers.' ) ;
2631} ) ;
2732
2833test ( '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