|
21 | 21 | // MODULES // |
22 | 22 |
|
23 | 23 | var tape = require( 'tape' ); |
24 | | -var isAccessorArray = require( '@stdlib/array-base-assert-is-accessor-array' ); |
25 | | -var Complex128Array = require( '@stdlib/array-complex128' ); |
26 | | -var toAccessorArray = 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 toAccessorArray, 'function', 'main export is a function' ); |
34 | | - t.end(); |
35 | | -}); |
36 | | - |
37 | | -tape( 'the function throws an error if not provided an array-like object', function test( t ) { |
38 | | - var values; |
39 | | - var i; |
40 | | - |
41 | | - values = [ |
42 | | - '5', |
43 | | - 3.14, |
44 | | - -1, |
45 | | - NaN, |
46 | | - true, |
47 | | - false, |
48 | | - null, |
49 | | - void 0, |
50 | | - {}, |
51 | | - function noop() {} |
52 | | - ]; |
53 | | - for ( i = 0; i < values.length; i++ ) { |
54 | | - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); |
55 | | - } |
56 | | - t.end(); |
57 | | - |
58 | | - function badValue( value ) { |
59 | | - return function badValue() { |
60 | | - return toAccessorArray( value ); |
61 | | - }; |
62 | | - } |
63 | | -}); |
64 | | - |
65 | | -tape( 'if provided an array-like not supporting the accessor protocol, the function returns an array-like object supporting the accessor protocol', function test( t ) { |
66 | | - var arr1 = [ 1, 2, 3 ]; |
67 | | - var arr2 = toAccessorArray( arr1 ); |
68 | | - t.strictEqual( isAccessorArray( arr2 ), true, 'returns expected value' ); |
69 | | - t.notEqual( arr1, arr2, 'returns new object' ); |
70 | | - t.end(); |
71 | | -}); |
72 | | - |
73 | | -tape( 'if provided an array-like object already supporting the accessor protocol, the function returns the input value', function test( t ) { |
74 | | - var arr1 = new Complex128Array( 10 ); |
75 | | - var arr2 = toAccessorArray( arr1 ); |
76 | | - t.strictEqual( isAccessorArray( arr2 ), true, 'returns expected value' ); |
77 | | - t.strictEqual( arr1, arr2, 'returns expected value' ); |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
78 | 32 | t.end(); |
79 | 33 | }); |
0 commit comments