Skip to content

Commit d4f47d1

Browse files
authored
test: add ternary argument tests
Signed-off-by: Athan <kgryte@gmail.com>
1 parent 3f72d99 commit d4f47d1

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

  • lib/node_modules/@stdlib/stats/base/ndarray/nanmin-by/docs/types

lib/node_modules/@stdlib/stats/base/ndarray/nanmin-by/docs/types/test.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function clbk( value: any ): number {
3838
{
3939
const x = zeros( [ 10 ], {
4040
'dtype': 'generic'
41-
} );
41+
});
4242

4343
nanminBy( [ x ], clbk ); // $ExpectType number
4444
nanminBy( [ x ], clbk, {} ); // $ExpectType number
@@ -55,13 +55,23 @@ function clbk( value: any ): number {
5555
nanminBy( [], clbk ); // $ExpectError
5656
nanminBy( {}, clbk ); // $ExpectError
5757
nanminBy( ( y: number ): number => y, clbk ); // $ExpectError
58+
59+
nanminBy( '10', clbk, {} ); // $ExpectError
60+
nanminBy( 10, clbk, {} ); // $ExpectError
61+
nanminBy( true, clbk, {} ); // $ExpectError
62+
nanminBy( false, clbk, {} ); // $ExpectError
63+
nanminBy( null, clbk, {} ); // $ExpectError
64+
nanminBy( undefined, clbk, {} ); // $ExpectError
65+
nanminBy( [], clbk, {} ); // $ExpectError
66+
nanminBy( {}, clbk, {} ); // $ExpectError
67+
nanminBy( ( y: number ): number => y, clbk, {} ); // $ExpectError
5868
}
5969

6070
// The compiler throws an error if the function is provided a second argument which is not a function...
6171
{
6272
const x = zeros( [ 10 ], {
6373
'dtype': 'generic'
64-
} );
74+
});
6575

6676
nanminBy( [ x ], '10' ); // $ExpectError
6777
nanminBy( [ x ], 10 ); // $ExpectError
@@ -71,13 +81,22 @@ function clbk( value: any ): number {
7181
nanminBy( [ x ], undefined ); // $ExpectError
7282
nanminBy( [ x ], [] ); // $ExpectError
7383
nanminBy( [ x ], {} ); // $ExpectError
84+
85+
nanminBy( [ x ], '10', {} ); // $ExpectError
86+
nanminBy( [ x ], 10, {} ); // $ExpectError
87+
nanminBy( [ x ], true, {} ); // $ExpectError
88+
nanminBy( [ x ], false, {} ); // $ExpectError
89+
nanminBy( [ x ], null, {} ); // $ExpectError
90+
nanminBy( [ x ], undefined, {} ); // $ExpectError
91+
nanminBy( [ x ], [], {} ); // $ExpectError
92+
nanminBy( [ x ], {}, {} ); // $ExpectError
7493
}
7594

7695
// The compiler throws an error if the function is provided an unsupported number of arguments...
7796
{
7897
const x = zeros( [ 10 ], {
7998
'dtype': 'generic'
80-
} );
99+
});
81100

82101
nanminBy( [ x ] ); // $ExpectError
83102
nanminBy( [ x ], clbk, {}, {} ); // $ExpectError

0 commit comments

Comments
 (0)