@@ -153,6 +153,23 @@ describe('assert', function () {
153
153
assert . typeOf ( function ( ) { } , 'asyncfunction' , 'blah' ) ;
154
154
} , "blah: expected [Function] to be an asyncfunction" ) ;
155
155
156
+ assert . typeOf ( 5n , 'bigint' ) ;
157
+
158
+ assert . typeOf ( ( ) => { } , 'function' ) ;
159
+ assert . typeOf ( function ( ) { } , 'function' ) ;
160
+ assert . typeOf ( async function ( ) { } , 'asyncfunction' ) ;
161
+ assert . typeOf ( function * ( ) { } , 'generatorfunction' ) ;
162
+ assert . typeOf ( async function * ( ) { } , 'asyncgeneratorfunction' ) ;
163
+ assert . typeOf ( Symbol ( ) , 'symbol' ) ;
164
+
165
+ err ( function ( ) {
166
+ assert . typeOf ( 5 , 'function' , 'blah' ) ;
167
+ } , "blah: expected 5 to be a function" ) ;
168
+
169
+ err ( function ( ) {
170
+ assert . typeOf ( function ( ) { } , 'asyncfunction' , 'blah' ) ;
171
+ } , "blah: expected [Function] to be an asyncfunction" ) ;
172
+
156
173
err ( function ( ) {
157
174
assert . typeOf ( 5 , 'string' , 'blah' ) ;
158
175
} , "blah: expected 5 to be a string" ) ;
@@ -632,6 +649,27 @@ describe('assert', function () {
632
649
} , "blah: expected 4 not to be a number" ) ;
633
650
} ) ;
634
651
652
+
653
+ it ( 'isNumeric' , function ( ) {
654
+ assert . isNumeric ( 1 ) ;
655
+ assert . isNumeric ( Number ( '3' ) ) ;
656
+ assert . isNumeric ( 6n ) ;
657
+ assert . isNumeric ( BigInt ( 9 ) ) ;
658
+
659
+ err ( function ( ) {
660
+ assert . isNumeric ( '1' , 'blah' ) ;
661
+ } , "blah: expected \'1\' to be numeric" ) ;
662
+ } ) ;
663
+
664
+ it ( 'isNotNumeric' , function ( ) {
665
+ assert . isNotNumeric ( 'hello' ) ;
666
+ assert . isNotNumeric ( [ 5 ] ) ;
667
+
668
+ err ( function ( ) {
669
+ assert . isNotNumeric ( 4 , 'blah' ) ;
670
+ } , "blah: expected 4 to not be numeric" ) ;
671
+ } ) ;
672
+
635
673
it ( 'isFinite' , function ( ) {
636
674
assert . isFinite ( 4 ) ;
637
675
assert . isFinite ( - 10 ) ;
@@ -1855,6 +1893,7 @@ describe('assert', function () {
1855
1893
assert . closeTo ( 1.5 , 1.0 , 0.5 ) ;
1856
1894
assert . closeTo ( 10 , 20 , 20 ) ;
1857
1895
assert . closeTo ( - 10 , 20 , 30 ) ;
1896
+ assert . closeTo ( 10 , 10 , 0 ) ;
1858
1897
1859
1898
err ( function ( ) {
1860
1899
assert . closeTo ( 2 , 1.0 , 0.5 , 'blah' ) ;
@@ -1866,25 +1905,26 @@ describe('assert', function () {
1866
1905
1867
1906
err ( function ( ) {
1868
1907
assert . closeTo ( [ 1.5 ] , 1.0 , 0.5 , 'blah' ) ;
1869
- } , "blah: expected [ 1.5 ] to be a number " ) ;
1908
+ } , "blah: expected [ 1.5 ] to be numeric " ) ;
1870
1909
1871
1910
err ( function ( ) {
1872
1911
assert . closeTo ( 1.5 , "1.0" , 0.5 , 'blah' ) ;
1873
- } , "blah: the arguments to closeTo or approximately must be numbers " ) ;
1912
+ } , "blah: expected '1.0' to be numeric " ) ;
1874
1913
1875
1914
err ( function ( ) {
1876
1915
assert . closeTo ( 1.5 , 1.0 , true , 'blah' ) ;
1877
- } , "blah: the arguments to closeTo or approximately must be numbers " ) ;
1916
+ } , "blah: expected true to be numeric " ) ;
1878
1917
1879
1918
err ( function ( ) {
1880
1919
assert . closeTo ( 1.5 , 1.0 , undefined , 'blah' ) ;
1881
- } , "blah: the arguments to closeTo or approximately must be numbers, and a delta is required" ) ;
1920
+ } , "blah: A ` delta` value is required for `closeTo` " ) ;
1882
1921
} ) ;
1883
1922
1884
1923
it ( 'approximately' , function ( ) {
1885
1924
assert . approximately ( 1.5 , 1.0 , 0.5 ) ;
1886
1925
assert . approximately ( 10 , 20 , 20 ) ;
1887
1926
assert . approximately ( - 10 , 20 , 30 ) ;
1927
+ assert . approximately ( 1n , 2n , 1n ) ;
1888
1928
1889
1929
err ( function ( ) {
1890
1930
assert . approximately ( 2 , 1.0 , 0.5 , 'blah' ) ;
@@ -1896,19 +1936,19 @@ describe('assert', function () {
1896
1936
1897
1937
err ( function ( ) {
1898
1938
assert . approximately ( [ 1.5 ] , 1.0 , 0.5 ) ;
1899
- } , "expected [ 1.5 ] to be a number " ) ;
1939
+ } , "expected [ 1.5 ] to be numeric " ) ;
1900
1940
1901
1941
err ( function ( ) {
1902
1942
assert . approximately ( 1.5 , "1.0" , 0.5 , 'blah' ) ;
1903
- } , "blah: the arguments to closeTo or approximately must be numbers " ) ;
1943
+ } , "blah: expected '1.0' to be numeric " ) ;
1904
1944
1905
1945
err ( function ( ) {
1906
1946
assert . approximately ( 1.5 , 1.0 , true , 'blah' ) ;
1907
- } , "blah: the arguments to closeTo or approximately must be numbers " ) ;
1947
+ } , "blah: expected true to be numeric " ) ;
1908
1948
1909
1949
err ( function ( ) {
1910
1950
assert . approximately ( 1.5 , 1.0 , undefined , 'blah' ) ;
1911
- } , "blah: the arguments to closeTo or approximately must be numbers, and a delta is required" ) ;
1951
+ } , "blah: A ` delta` value is required for `closeTo` " ) ;
1912
1952
} ) ;
1913
1953
1914
1954
it ( 'sameMembers' , function ( ) {
@@ -2135,6 +2175,10 @@ describe('assert', function () {
2135
2175
2136
2176
it ( 'above' , function ( ) {
2137
2177
assert . isAbove ( 5 , 2 , '5 should be above 2' ) ;
2178
+ assert . isAbove ( 5n , 2 , '5 should be above 2' ) ;
2179
+ assert . isAbove ( 5 , 2n , '5 should be above 2' ) ;
2180
+ assert . isAbove ( 5n , 2n , '5 should be above 2' ) ;
2181
+ assert . isAbove ( 9007199254740994n , 2 , '9007199254740994 should be above 2' ) ;
2138
2182
2139
2183
err ( function ( ) {
2140
2184
assert . isAbove ( 1 , 3 , 'blah' ) ;
@@ -2186,6 +2230,8 @@ describe('assert', function () {
2186
2230
it ( 'atLeast' , function ( ) {
2187
2231
assert . isAtLeast ( 5 , 2 , '5 should be above 2' ) ;
2188
2232
assert . isAtLeast ( 1 , 1 , '1 should be equal to 1' ) ;
2233
+ assert . isAtLeast ( 5n , 2 , '5 should be above 2' ) ;
2234
+ assert . isAtLeast ( 1 , 1n , '1 should be equal to 1' ) ;
2189
2235
2190
2236
err ( function ( ) {
2191
2237
assert . isAtLeast ( 1 , 3 , 'blah' ) ;
@@ -2231,6 +2277,9 @@ describe('assert', function () {
2231
2277
2232
2278
it ( 'below' , function ( ) {
2233
2279
assert . isBelow ( 2 , 5 , '2 should be below 5' ) ;
2280
+ assert . isBelow ( 2 , 5n , '2 should be below 5' ) ;
2281
+ assert . isBelow ( 2n , 5 , '2 should be below 5' ) ;
2282
+ assert . isBelow ( 2n , 5n , '2 should be below 5' ) ;
2234
2283
2235
2284
err ( function ( ) {
2236
2285
assert . isBelow ( 3 , 1 , 'blah' ) ;
@@ -2282,6 +2331,8 @@ describe('assert', function () {
2282
2331
it ( 'atMost' , function ( ) {
2283
2332
assert . isAtMost ( 2 , 5 , '2 should be below 5' ) ;
2284
2333
assert . isAtMost ( 1 , 1 , '1 should be equal to 1' ) ;
2334
+ assert . isAtMost ( 2n , 5 , '2 should be below 5' ) ;
2335
+ assert . isAtMost ( 1 , 1n , '1 should be equal to 1' ) ;
2285
2336
2286
2337
err ( function ( ) {
2287
2338
assert . isAtMost ( 3 , 1 , 'blah' ) ;
0 commit comments