From efdd37537b21628b0bb709b0f9964d40b797d4cb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 12 Oct 2023 01:54:52 +0000 Subject: [PATCH] Auto-generated commit --- to-array/test/test.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/to-array/test/test.js b/to-array/test/test.js index b16fc531..673188aa 100644 --- a/to-array/test/test.js +++ b/to-array/test/test.js @@ -37,6 +37,34 @@ tape( 'main export is a function', function test( t ) { t.end(); }); +tape( 'the function throws an error if not provided an ndarray-like object', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + ndarray2array( value ); + }; + } +}); + tape( 'the function returns an empty array if provided an ndarray', function test( t ) { var out; var arr;