|
1 | 1 | /** |
2 | 2 | * @license Apache-2.0 |
3 | 3 | * |
4 | | -* Copyright (c) 2018 The Stdlib Authors. |
| 4 | +* Copyright (c) 2023 The Stdlib Authors. |
5 | 5 | * |
6 | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | * you may not use this file except in compliance with the License. |
|
21 | 21 | // MODULES // |
22 | 22 |
|
23 | 23 | var tape = require( 'tape' ); |
24 | | -var Float64Array = require( '@stdlib/array-float64' ); |
25 | | -var Number = require( '@stdlib/number-ctor' ); |
26 | | -var isNaNArray = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
27 | 25 |
|
28 | 26 |
|
29 | 27 | // TESTS // |
30 | 28 |
|
31 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
32 | 30 | t.ok( true, __filename ); |
33 | | - t.strictEqual( typeof isNaNArray, 'function', 'main export is a function' ); |
34 | | - t.end(); |
35 | | -}); |
36 | | - |
37 | | -tape( 'the function tests for an array-like object containing only `NaN` values', function test( t ) { |
38 | | - var arr; |
39 | | - |
40 | | - arr = [ NaN, new Number( NaN ), NaN ]; |
41 | | - t.equal( isNaNArray( arr ), true, 'returns true' ); |
42 | | - |
43 | | - arr = new Float64Array( [ NaN, NaN ] ); |
44 | | - t.equal( isNaNArray( arr ), true, 'returns true' ); |
45 | | - |
46 | | - arr = { |
47 | | - 'length': 2, |
48 | | - '0': NaN, |
49 | | - '1': NaN |
50 | | - }; |
51 | | - t.equal( isNaNArray( arr ), true, 'returns true' ); |
52 | | - |
53 | | - arr = [ NaN, 3, NaN ]; |
54 | | - t.equal( isNaNArray( arr ), false, 'returns false' ); |
55 | | - |
56 | | - arr = [ NaN, null, NaN ]; |
57 | | - t.equal( isNaNArray( arr ), false, 'returns false' ); |
58 | | - |
59 | | - t.end(); |
60 | | -}); |
61 | | - |
62 | | -tape( 'attached to the main export is a method to test for an array-like object containing only primitive `NaN` values', function test( t ) { |
63 | | - var arr; |
64 | | - |
65 | | - arr = [ NaN, NaN, NaN ]; |
66 | | - t.equal( isNaNArray.primitives( arr ), true, 'returns true' ); |
67 | | - |
68 | | - arr = new Float64Array( [ NaN, NaN ] ); |
69 | | - t.equal( isNaNArray.primitives( arr ), true, 'returns true' ); |
70 | | - |
71 | | - arr = { |
72 | | - 'length': 2, |
73 | | - '0': NaN, |
74 | | - '1': NaN |
75 | | - }; |
76 | | - t.equal( isNaNArray.primitives( arr ), true, 'returns true' ); |
77 | | - |
78 | | - arr = [ new Number( NaN ), NaN, NaN ]; |
79 | | - t.equal( isNaNArray.primitives( arr ), false, 'returns false' ); |
80 | | - |
81 | | - arr = new Float64Array( [ 2.3, NaN ] ); |
82 | | - t.equal( isNaNArray.primitives( arr ), false, 'returns false' ); |
83 | | - |
84 | | - t.end(); |
85 | | -}); |
86 | | - |
87 | | -tape( 'attached to the main export is a method to test for an array-like object containing only object `NaN` values', function test( t ) { |
88 | | - var arr; |
89 | | - |
90 | | - arr = [ NaN, NaN, NaN ]; |
91 | | - t.equal( isNaNArray.objects( arr ), false, 'returns false' ); |
92 | | - |
93 | | - arr = [ new Number( NaN ), NaN, NaN ]; |
94 | | - t.equal( isNaNArray.objects( arr ), false, 'returns false' ); |
95 | | - |
96 | | - arr = { |
97 | | - 'length': 2, |
98 | | - '0': new Number( NaN ), |
99 | | - '1': new Number( NaN ) |
100 | | - }; |
101 | | - t.equal( isNaNArray.objects( arr ), true, 'returns true' ); |
102 | | - |
103 | | - arr = [ new Number( NaN ), new Number( NaN ), new Number( NaN ) ]; |
104 | | - t.equal( isNaNArray.objects( arr ), true, 'returns true' ); |
105 | | - |
106 | | - arr = new Float64Array( [ NaN, NaN, NaN ] ); |
107 | | - t.equal( isNaNArray.objects( arr ), false, 'returns false' ); |
108 | | - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
109 | 32 | t.end(); |
110 | 33 | }); |
0 commit comments