File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
lib/node_modules/@stdlib/string/first/test Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,33 @@ tape( 'the function throws an error if not provided a string', function test( t
5959 }
6060} ) ;
6161
62+ tape ( 'the function throws an error if not provided a string (options)' , function test ( t ) {
63+ var values ;
64+ var i ;
65+
66+ values = [
67+ 5 ,
68+ null ,
69+ true ,
70+ void 0 ,
71+ NaN ,
72+ [ ] ,
73+ { } ,
74+ function noop ( ) { }
75+ ] ;
76+
77+ for ( i = 0 ; i < values . length ; i ++ ) {
78+ t . throws ( badValue ( values [ i ] ) , TypeError , 'throws an error when provided ' + values [ i ] ) ;
79+ }
80+ t . end ( ) ;
81+
82+ function badValue ( value ) {
83+ return function badValue ( ) {
84+ first ( value , { } ) ;
85+ } ;
86+ }
87+ } ) ;
88+
6289tape ( 'the function throws an error if provided a second argument which is not a nonnegative integer' , function test ( t ) {
6390 var values ;
6491 var i ;
You can’t perform that action at this time.
0 commit comments