@@ -4,7 +4,9 @@ const test = require('tap').test
44const build = require ( '..' )
55
66test ( 'Finite numbers' , t => {
7- const values = [ - 5 , 0 , - 0 , 1.33 , Math . E , Number . EPSILON , Number . MAX_SAFE_INTEGER , Number . MAX_VALUE ,
7+ const values = [ - 5 , 0 , - 0 , 1.33 , 99 , 100.0 ,
8+ Math . E , Number . EPSILON ,
9+ Number . MAX_SAFE_INTEGER , Number . MAX_VALUE ,
810 Number . MIN_SAFE_INTEGER , Number . MIN_VALUE ]
911
1012 t . plan ( values . length )
@@ -18,13 +20,13 @@ test('Finite numbers', t => {
1820 values . forEach ( v => t . equal ( stringify ( v ) , JSON . stringify ( v ) ) )
1921} )
2022
21- test ( 'Infinite numbers ' , t => {
23+ test ( 'Infinite integers ' , t => {
2224 const values = [ Infinity , - Infinity ]
2325
2426 t . plan ( values . length )
2527
2628 const schema = {
27- type : 'number '
29+ type : 'integer '
2830 }
2931
3032 const stringify = build ( schema )
@@ -33,7 +35,21 @@ test('Infinite numbers', t => {
3335 try {
3436 stringify ( v )
3537 } catch ( err ) {
36- t . equal ( err . message , `The value "${ v } " cannot be converted to a number .` )
38+ t . equal ( err . message , `The value "${ v } " cannot be converted to an integer .` )
3739 }
3840 } )
3941} )
42+
43+ test ( 'Infinite numbers' , t => {
44+ const values = [ Infinity , - Infinity ]
45+
46+ t . plan ( values . length )
47+
48+ const schema = {
49+ type : 'number'
50+ }
51+
52+ const stringify = build ( schema )
53+
54+ values . forEach ( v => t . equal ( stringify ( v ) , JSON . stringify ( v ) ) )
55+ } )
0 commit comments