|
1 | 1 | /**
|
2 | 2 | * @license Apache-2.0
|
3 | 3 | *
|
4 |
| -* Copyright (c) 2020 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 IS_BROWSER = require( '@stdlib/assert-is-browser' ); |
26 |
| -var drev = require( './../../dist' ); |
27 |
| - |
28 |
| - |
29 |
| -// VARIABLES // |
30 |
| - |
31 |
| -var opts = { |
32 |
| - 'skip': IS_BROWSER |
33 |
| -}; |
| 24 | +var main = require( './../../dist' ); |
34 | 25 |
|
35 | 26 |
|
36 | 27 | // TESTS //
|
37 | 28 |
|
38 |
| -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
39 | 30 | t.ok( true, __filename );
|
40 |
| - t.strictEqual( typeof drev, 'function', 'main export is a function' ); |
41 |
| - t.end(); |
42 |
| -}); |
43 |
| - |
44 |
| -tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { |
45 |
| - t.strictEqual( typeof drev.ndarray, 'function', 'method is a function' ); |
46 |
| - t.end(); |
47 |
| -}); |
48 |
| - |
49 |
| -tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { |
50 |
| - var drev = proxyquire( './../dist', { |
51 |
| - '@stdlib/utils-try-require': tryRequire |
52 |
| - }); |
53 |
| - |
54 |
| - t.strictEqual( drev, mock, 'returns native implementation' ); |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
55 | 32 | t.end();
|
56 |
| - |
57 |
| - function tryRequire() { |
58 |
| - return mock; |
59 |
| - } |
60 |
| - |
61 |
| - function mock() { |
62 |
| - // Mock... |
63 |
| - } |
64 |
| -}); |
65 |
| - |
66 |
| -tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { |
67 |
| - var drev; |
68 |
| - var main; |
69 |
| - |
70 |
| - main = require( './../../dist/drev.js' ); |
71 |
| - |
72 |
| - drev = proxyquire( './../dist', { |
73 |
| - '@stdlib/utils-try-require': tryRequire |
74 |
| - }); |
75 |
| - |
76 |
| - t.strictEqual( drev, main, 'returns JavaScript implementation' ); |
77 |
| - t.end(); |
78 |
| - |
79 |
| - function tryRequire() { |
80 |
| - return new Error( 'Cannot find module' ); |
81 |
| - } |
82 | 33 | });
|
0 commit comments