|
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 MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' ); |
25 | | -var isTypedArrayLength = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
26 | 25 |
|
27 | 26 |
|
28 | 27 | // TESTS // |
29 | 28 |
|
30 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
31 | 30 | t.ok( true, __filename ); |
32 | | - t.strictEqual( typeof isTypedArrayLength, 'function', 'main export is a function' ); |
33 | | - t.end(); |
34 | | -}); |
35 | | - |
36 | | -tape( 'the function returns `true` if provided a valid typed array length', function test( t ) { |
37 | | - t.strictEqual( isTypedArrayLength( 0 ), true, 'returns true' ); |
38 | | - t.strictEqual( isTypedArrayLength( 10 ), true, 'returns true' ); |
39 | | - t.strictEqual( isTypedArrayLength( MAX_LENGTH ), true, 'returns true' ); |
40 | | - t.end(); |
41 | | -}); |
42 | | - |
43 | | -tape( 'the function returns `false` if not provided a valid typed array length', function test( t ) { |
44 | | - t.strictEqual( isTypedArrayLength( MAX_LENGTH+1 ), false, 'returns false' ); |
45 | | - t.strictEqual( isTypedArrayLength( -1 ), false, 'returns false' ); |
46 | | - t.strictEqual( isTypedArrayLength( 3.14 ), false, 'returns false' ); |
47 | | - t.end(); |
48 | | -}); |
49 | | - |
50 | | -tape( 'the function returns `false` if not provided a number', function test( t ) { |
51 | | - var values; |
52 | | - var i; |
53 | | - |
54 | | - values = [ |
55 | | - '5', |
56 | | - NaN, |
57 | | - null, |
58 | | - true, |
59 | | - false, |
60 | | - void 0, |
61 | | - [], |
62 | | - {}, |
63 | | - function noop() {} |
64 | | - ]; |
65 | | - |
66 | | - for ( i = 0; i < values.length; i++ ) { |
67 | | - t.strictEqual( isTypedArrayLength( values[i] ), false, 'returns false when provided '+values[i] ); |
68 | | - } |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
69 | 32 | t.end(); |
70 | 33 | }); |
0 commit comments