Skip to content

Commit dc302b7

Browse files
committed
test: fix broken tests
--- 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: na - 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: passed - task: lint_license_headers status: passed ---
1 parent 9168604 commit dc302b7

File tree

1 file changed

+27
-59
lines changed
  • lib/node_modules/@stdlib/ndarray/base/map/docs/types

1 file changed

+27
-59
lines changed

lib/node_modules/@stdlib/ndarray/base/map/docs/types/test.ts

Lines changed: 27 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,9 @@
1616
* limitations under the License.
1717
*/
1818

19-
/// <reference types="@stdlib/types"/>
20-
21-
import { ndarray } from '@stdlib/types/ndarray';
19+
import zeros = require( '@stdlib/ndarray/zeros' );
2220
import map = require( './index' );
2321

24-
/**
25-
* Mock function to create an ndarray-like object.
26-
*
27-
* @returns ndarray-like object
28-
*/
29-
function array(): ndarray {
30-
const obj: ndarray = {
31-
'byteLength': 80,
32-
'BYTES_PER_ELEMENT': 8,
33-
'data': new Float64Array( 10 ),
34-
'dtype': 'float64',
35-
'flags': {
36-
'ROW_MAJOR_CONTIGUOUS': true,
37-
'COLUMN_MAJOR_CONTIGUOUS': false
38-
},
39-
'length': 10,
40-
'ndims': 1,
41-
'offset': 0,
42-
'order': 'row-major',
43-
'shape': [ 10 ],
44-
'strides': [ 1 ],
45-
'get': (): number => 0,
46-
'set': (): ndarray => obj
47-
};
48-
return obj;
49-
}
50-
5122
/**
5223
* Evaluates the identity function.
5324
*
@@ -62,12 +33,11 @@ function identity( x: number ): number {
6233

6334
// The function returns `undefined`...
6435
{
65-
const x = array();
66-
const y = array();
67-
const arrays = [ x, y ];
36+
const x = zeros( [ 2, 2 ] );
37+
const y = zeros( [ 2, 2 ] );
6838

69-
map( arrays, identity ); // $ExpectType void
70-
map( arrays, identity, {} ); // $ExpectType void
39+
map( [ x, y ], identity ); // $ExpectType void
40+
map( [ x, y ], identity, {} ); // $ExpectType void
7141
}
7242

7343
// The compiler throws an error if the function is provided a first argument which is not an array-like object containing ndarray-like objects...
@@ -93,36 +63,34 @@ function identity( x: number ): number {
9363

9464
// The compiler throws an error if the function is provided a second argument which is not a callback function...
9565
{
96-
const x = array();
97-
const y = array();
98-
const arrays = [ x, y ];
66+
const x = zeros( [ 2, 2 ] );
67+
const y = zeros( [ 2, 2 ] );
9968

100-
map( arrays, '10' ); // $ExpectError
101-
map( arrays, 5 ); // $ExpectError
102-
map( arrays, true ); // $ExpectError
103-
map( arrays, false ); // $ExpectError
104-
map( arrays, null ); // $ExpectError
105-
map( arrays, undefined ); // $ExpectError
106-
map( arrays, [] ); // $ExpectError
107-
map( arrays, {} ); // $ExpectError
69+
map( [ x, y ], '10' ); // $ExpectError
70+
map( [ x, y ], 5 ); // $ExpectError
71+
map( [ x, y ], true ); // $ExpectError
72+
map( [ x, y ], false ); // $ExpectError
73+
map( [ x, y ], null ); // $ExpectError
74+
map( [ x, y ], undefined ); // $ExpectError
75+
map( [ x, y ], [] ); // $ExpectError
76+
map( [ x, y ], {} ); // $ExpectError
10877

109-
map( arrays, '10', {} ); // $ExpectError
110-
map( arrays, 5, {} ); // $ExpectError
111-
map( arrays, true, {} ); // $ExpectError
112-
map( arrays, false, {} ); // $ExpectError
113-
map( arrays, null, {} ); // $ExpectError
114-
map( arrays, undefined, {} ); // $ExpectError
115-
map( arrays, [], {} ); // $ExpectError
116-
map( arrays, {}, {} ); // $ExpectError
78+
map( [ x, y ], '10', {} ); // $ExpectError
79+
map( [ x, y ], 5, {} ); // $ExpectError
80+
map( [ x, y ], true, {} ); // $ExpectError
81+
map( [ x, y ], false, {} ); // $ExpectError
82+
map( [ x, y ], null, {} ); // $ExpectError
83+
map( [ x, y ], undefined, {} ); // $ExpectError
84+
map( [ x, y ], [], {} ); // $ExpectError
85+
map( [ x, y ], {}, {} ); // $ExpectError
11786
}
11887

11988
// The compiler throws an error if the function is provided an unsupported number of arguments...
12089
{
121-
const x = array();
122-
const y = array();
123-
const arrays = [ x, y ];
90+
const x = zeros( [ 2, 2 ] );
91+
const y = zeros( [ 2, 2 ] );
12492

12593
map(); // $ExpectError
126-
map( arrays ); // $ExpectError{
127-
map( arrays, identity, {}, {} ); // $ExpectError
94+
map( [ x, y ] ); // $ExpectError{
95+
map( [ x, y ], identity, {}, {} ); // $ExpectError
12896
}

0 commit comments

Comments
 (0)