Skip to content

Commit 84abd98

Browse files
committed
test: add missing test case
1 parent 1191cc5 commit 84abd98

File tree

1 file changed

+34
-1
lines changed
  • lib/node_modules/@stdlib/ndarray/map/test

1 file changed

+34
-1
lines changed

lib/node_modules/@stdlib/ndarray/map/test/test.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ tape( 'the function throws an error if provided a first argument having an unrec
7979
}
8080
});
8181

82-
tape( 'the function throws an error if the callback function is not provided', function test( t ) {
82+
tape( 'the function throws an error if the second argument is not a function when options are not provided', function test( t ) {
8383
var values;
8484
var x;
8585
var i;
@@ -108,6 +108,39 @@ tape( 'the function throws an error if the callback function is not provided', f
108108
}
109109
});
110110

111+
tape( 'the function throws an error if third argument is not a function when options are provided', function test( t ) {
112+
var values;
113+
var opts;
114+
var x;
115+
var i;
116+
117+
values = [
118+
'5',
119+
5,
120+
true,
121+
false,
122+
null,
123+
void 0,
124+
{},
125+
[]
126+
];
127+
x = ndarray( 'generic', ones( 4, 'generic' ), [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
128+
opts = {
129+
'dtype': 'float64'
130+
};
131+
132+
for ( i = 0; i < values.length; i++ ) {
133+
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided ' + values[i] );
134+
}
135+
t.end();
136+
137+
function badValue( value ) {
138+
return function badValue() {
139+
map( x, opts, value );
140+
};
141+
}
142+
});
143+
111144
tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) {
112145
var values;
113146
var x;

0 commit comments

Comments
 (0)