@@ -7,45 +7,58 @@ describe('flexRange()', () => {
77 it ( `should be a function` , ( ) => {
88 expect ( flexRange ) . to . be . a ( 'function' ) ;
99 } ) ;
10- it ( `should return a positive random number` , ( ) => {
11- expect ( flexRange ( 10 ) ) . to . be . a ( 'number' ) . and . be . at . least ( 0 ) ;
12- expect ( flexRange ( '10' ) ) . to . be . an ( 'number' ) . and . be . at . least ( 0 ) ;
10+ it ( `should return a positive random number` , async ( ) => {
11+ const result1 = await flexRange ( 10 )
12+ expect ( result1 ) . to . be . a ( 'number' ) . and . be . at . least ( 0 ) ;
13+ const result2 = await flexRange ( '10' )
14+ expect ( result2 ) . to . be . an ( 'number' ) . and . be . at . least ( 0 ) ;
1315 } ) ;
14- it ( `should return a negative random number` , ( ) => {
15- expect ( flexRange ( - 10 ) ) . to . be . a ( 'number' ) . and . to . be . at . most ( 0 ) ;
16- expect ( flexRange ( '-10' ) ) . to . be . an ( 'number' ) . and . to . be . at . most ( 0 ) ;
16+ it ( `should return a negative random number` , async ( ) => {
17+ const result1 = await flexRange ( - 10 )
18+ expect ( result1 ) . to . be . a ( 'number' ) . and . to . be . at . most ( 0 ) ;
19+ const result2 = await flexRange ( '-10' )
20+ expect ( result2 ) . to . be . an ( 'number' ) . and . to . be . at . most ( 0 ) ;
1721 } ) ;
18- it ( `should return randomly 0 or 1 if passed no arguments` , ( ) => {
19- expect ( flexRange ( ) ) . to . be . within ( 0 , 1 ) ;
22+ it ( `should return randomly 0 or 1 if passed no arguments` , async ( ) => {
23+ const result = await flexRange ( )
24+ expect ( result ) . to . be . within ( 0 , 1 ) ;
2025 } ) ;
2126} ) ;
2227
2328describe ( 'setRange()' , ( ) => {
2429 it ( `should be a function` , ( ) => {
2530 expect ( setRange ) . to . be . a ( 'function' ) ;
2631 } ) ;
27- it ( `should return randomly -100 to 100 if passed no arguments` , ( ) => {
28- expect ( setRange ( ) ) . to . be . an ( 'number' ) . to . be . within ( - 100 , 100 ) ;
32+ it ( `should return randomly -100 to 100 if passed no arguments` , async ( ) => {
33+ const result = await setRange ( )
34+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( - 100 , 100 ) ;
2935 } ) ;
30- it ( `should return randomly 10 to 50 if passed those values` , ( ) => {
31- expect ( setRange ( 10 , 50 ) ) . to . be . an ( 'number' ) . to . be . within ( 10 , 50 ) ;
36+ it ( `should return randomly 10 to 50 if passed those values` , async ( ) => {
37+ const result = await setRange ( 10 , 50 )
38+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( 10 , 50 ) ;
3239 } ) ;
33- it ( `should handle if order is flipped` , ( ) => {
34- expect ( setRange ( 50 , 10 ) ) . to . be . an ( 'number' ) . to . be . within ( 10 , 50 ) ;
40+ it ( `should handle if order is flipped` , async ( ) => {
41+ const result = await setRange ( 50 , 10 )
42+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( 10 , 50 ) ;
3543 } ) ;
36- it ( `should handle mixed positive/negative numbers (-10 to 10)` , ( ) => {
37- expect ( setRange ( - 10 , 10 ) ) . to . be . an ( 'number' ) . to . be . within ( - 10 , 10 ) ;
44+ it ( `should handle mixed positive/negative numbers (-10 to 10)` , async ( ) => {
45+ const result = await setRange ( - 10 , 10 )
46+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( - 10 , 10 ) ;
3847 } ) ;
39- it ( `should handle negative numbers (-10 to -50)` , ( ) => {
40- expect ( setRange ( - 10 , - 50 ) ) . to . be . an ( 'number' ) . to . be . within ( - 50 , - 10 ) ;
48+ it ( `should handle negative numbers (-10 to -50)` , async ( ) => {
49+ const result = await setRange ( - 10 , - 50 )
50+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( - 50 , - 10 ) ;
4151 } ) ;
42- it ( `should handle numbers as strings ('10' to '-50')` , ( ) => {
43- expect ( setRange ( '10' , '-50' ) ) . to . be . an ( 'number' ) . to . be . within ( - 50 , 10 ) ;
52+ it ( `should handle numbers as strings ('10' to '-50')` , async ( ) => {
53+ const result = await setRange ( '10' , '-50' )
54+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( - 50 , 10 ) ;
4455 } ) ;
45- it ( `should handle mixed numbers as strings ('10' to -50)` , ( ) => {
46- expect ( setRange ( '10' , - 50 ) ) . to . be . an ( 'number' ) . to . be . within ( - 50 , 10 ) ;
56+ it ( `should handle mixed numbers as strings ('10' to -50)` , async ( ) => {
57+ const result = await setRange ( '10' , - 50 )
58+ expect ( result ) . to . be . an ( 'number' ) . to . be . within ( - 50 , 10 ) ;
4759 } ) ;
48- it ( `should default to flexRange() behavior if input is the same` , ( ) => {
49- expect ( setRange ( 10 , 10 ) ) . to . be . an ( 'number' ) . and . be . greaterThan ( - 1 ) ;
60+ it ( `should default to flexRange() behavior if input is the same` , async ( ) => {
61+ const result = await setRange ( 10 , 10 )
62+ expect ( result ) . to . be . an ( 'number' ) . and . be . greaterThan ( - 1 ) ;
5063 } ) ;
5164} ) ;
0 commit comments