1
1
const { isPositiveInteger } = require ( '../lib/isPositiveInteger' ) ;
2
- const MAX_SAFE_INTEGER = 9007199254740991 ;
2
+
3
+ const MAX_SAFE_INTEGER = 9007199254740991 ;
3
4
describe ( 'IsPositiveInteger' , ( ) => {
4
5
it ( 'should return true for positive integers' , ( ) => {
5
-
6
- expect ( isPositiveInteger ( 2 , 4 , 200 ) ) . toBe ( true )
7
- expect ( isPositiveInteger ( MAX_SAFE_INTEGER , 4 , 200 ) ) . toBe ( true )
8
- expect ( isPositiveInteger ( 34 , 98 , 225 , 56 ) ) . toBe ( true )
6
+ expect ( isPositiveInteger ( 2 , 4 , 200 ) ) . toBe ( true ) ;
7
+ expect ( isPositiveInteger ( MAX_SAFE_INTEGER , 4 , 200 ) ) . toBe ( true ) ;
8
+ expect ( isPositiveInteger ( 34 , 98 , 225 , 56 ) ) . toBe ( true ) ;
9
9
} ) ;
10
10
11
11
it ( 'should return false for negative numbers or 0' , ( ) => {
12
-
13
- expect ( isPositiveInteger ( 0 , 4 , 200 ) ) . toBe ( false )
14
- expect ( isPositiveInteger ( - 3 , - 4 , - 200 ) ) . toBe ( false )
15
- expect ( isPositiveInteger ( 34 , - 98 , 225 , 56 ) ) . toBe ( false )
12
+ expect ( isPositiveInteger ( 0 , 4 , 200 ) ) . toBe ( false ) ;
13
+ expect ( isPositiveInteger ( - 3 , - 4 , - 200 ) ) . toBe ( false ) ;
14
+ expect ( isPositiveInteger ( 34 , - 98 , 225 , 56 ) ) . toBe ( false ) ;
16
15
} ) ;
17
16
18
- it ( 'should return false for floats' , ( ) => {
19
- expect ( isPositiveInteger ( 2.6 , 4.9 , 23.67 ) ) . toBe ( false )
20
- expect ( isPositiveInteger ( 2 , 4 , 23.67 ) ) . toBe ( false )
21
- expect ( isPositiveInteger ( - 10.2 , - 4.6 , - 200.4 ) ) . toBe ( false )
22
- expect ( isPositiveInteger ( - 32.7 , 98 , 225 , 56 ) ) . toBe ( false )
17
+ it ( 'should return false for floats' , ( ) => {
18
+ expect ( isPositiveInteger ( 2.6 , 4.9 , 23.67 ) ) . toBe ( false ) ;
19
+ expect ( isPositiveInteger ( 2 , 4 , 23.67 ) ) . toBe ( false ) ;
20
+ expect ( isPositiveInteger ( - 10.2 , - 4.6 , - 200.4 ) ) . toBe ( false ) ;
21
+ expect ( isPositiveInteger ( - 32.7 , 98 , 225 , 56 ) ) . toBe ( false ) ;
23
22
} ) ;
24
23
25
- it ( 'should return false for other values' , ( ) => {
26
- expect ( isPositiveInteger ( { } ) ) . toBe ( false )
27
- expect ( isPositiveInteger ( 2 , [ ] ) ) . toBe ( false )
28
- expect ( isPositiveInteger ( 1 , 'S' ) ) . toBe ( false )
29
- expect ( isPositiveInteger ( MAX_SAFE_INTEGER + 1 ) ) . toBe ( false )
30
-
24
+ it ( 'should return false for other values' , ( ) => {
25
+ expect ( isPositiveInteger ( { } ) ) . toBe ( false ) ;
26
+ expect ( isPositiveInteger ( 2 , [ ] ) ) . toBe ( false ) ;
27
+ expect ( isPositiveInteger ( 1 , 'S' ) ) . toBe ( false ) ;
28
+ expect ( isPositiveInteger ( MAX_SAFE_INTEGER + 1 ) ) . toBe ( false ) ;
31
29
} ) ;
32
- } ) ;
30
+ } ) ;
0 commit comments