|
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 proxyquire = require( 'proxyquire' ); |
25 |
| -var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' ); |
26 |
| -var polyfill = require( './../../dist/polyfill.js' ); |
27 |
| -var ctor = require( './../../dist' ); |
28 |
| - |
29 |
| - |
30 |
| -// VARIABLES // |
31 |
| - |
32 |
| -var hasUint8Arrays = hasUint8ArraySupport(); |
| 24 | +var main = require( './../../dist' ); |
33 | 25 |
|
34 | 26 |
|
35 | 27 | // TESTS //
|
36 | 28 |
|
37 |
| -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
38 | 30 | t.ok( true, __filename );
|
39 |
| - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); |
40 |
| - t.end(); |
41 |
| -}); |
42 |
| - |
43 |
| -tape( 'if an environment supports `Uint8Array`, the export is an alias for `Uint8Array`', function test( t ) { |
44 |
| - var Foo; |
45 |
| - |
46 |
| - Foo = proxyquire( './../dist', { |
47 |
| - '@stdlib/assert-has-uint8array-support': isTrue, |
48 |
| - './main.js': Mock |
49 |
| - }); |
50 |
| - t.strictEqual( Foo, Mock, 'returns builtin' ); |
51 |
| - |
52 |
| - if ( hasUint8Arrays ) { |
53 |
| - t.strictEqual( ctor, Uint8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals |
54 |
| - } |
55 |
| - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
56 | 32 | t.end();
|
57 |
| - |
58 |
| - function Mock() { |
59 |
| - return this; |
60 |
| - } |
61 |
| - |
62 |
| - function isTrue() { |
63 |
| - return true; |
64 |
| - } |
65 |
| -}); |
66 |
| - |
67 |
| -tape( 'if an environment does not support `Uint8Array`, the export is a polyfill', function test( t ) { |
68 |
| - var Foo; |
69 |
| - |
70 |
| - Foo = proxyquire( './../dist', { |
71 |
| - '@stdlib/assert-has-uint8array-support': isFalse |
72 |
| - }); |
73 |
| - |
74 |
| - t.strictEqual( Foo, polyfill, 'returns polyfill' ); |
75 |
| - t.end(); |
76 |
| - |
77 |
| - function isFalse() { |
78 |
| - return false; |
79 |
| - } |
80 | 33 | });
|
0 commit comments