Skip to content

Commit eac69a7

Browse files
committed
chore: fix test
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent fb97790 commit eac69a7

File tree

1 file changed

+43
-7
lines changed
  • lib/node_modules/@stdlib/lapack/base/dladiv/test

1 file changed

+43
-7
lines changed

lib/node_modules/@stdlib/lapack/base/dladiv/test/test.js

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var isMethod = require( '@stdlib/assert/is-method' );
24+
var proxyquire = require( 'proxyquire' );
25+
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2526
var dladiv = require( './../lib' );
2627

2728

29+
// VARIABLES //
30+
31+
var opts = {
32+
'skip': IS_BROWSER
33+
};
34+
35+
2836
// TESTS //
2937

3038
tape( 'main export is a function', function test( t ) {
@@ -33,14 +41,42 @@ tape( 'main export is a function', function test( t ) {
3341
t.end();
3442
});
3543

36-
tape( 'attached to the main export is an `assign` method', function test( t ) {
37-
t.ok( true, __filename );
38-
t.strictEqual( isMethod( dladiv, 'assign' ), true, 'returns expected value' );
44+
tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) {
45+
t.strictEqual( typeof dladiv.ndarray, 'function', 'method is a function' );
3946
t.end();
4047
});
4148

42-
tape( 'attached to the main export is a `strided` method', function test( t ) {
43-
t.ok( true, __filename );
44-
t.strictEqual( isMethod( dladiv, 'strided' ), true, 'returns expected value' );
49+
tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) {
50+
var dladiv = proxyquire( './../lib', {
51+
'@stdlib/utils/try-require': tryRequire
52+
});
53+
54+
t.strictEqual( dladiv, mock, 'returns expected value' );
4555
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 dladiv;
68+
var main;
69+
70+
main = require( './../lib/dladiv.js' );
71+
72+
dladiv = proxyquire( './../lib', {
73+
'@stdlib/utils/try-require': tryRequire
74+
});
75+
76+
t.strictEqual( dladiv, main, 'returns expected value' );
77+
t.end();
78+
79+
function tryRequire() {
80+
return new Error( 'Cannot find module' );
81+
}
4682
});

0 commit comments

Comments
 (0)