File tree 1 file changed +30
-1
lines changed
1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ const assert = require('assert');
9
9
const {
10
10
assertIsObject,
11
11
assertWithinRange,
12
- sessionName
12
+ sessionName,
13
+ assertIsArray
13
14
} = require ( 'internal/http2/util' ) ;
14
15
15
16
// Code coverage for sessionName utility function
@@ -49,3 +50,31 @@ assert.throws(
49
50
} ) ;
50
51
51
52
assertIsObject ( { } , 'test' ) ;
53
+
54
+ assert . throws (
55
+ ( ) => assertIsArray ( 'foo' , 'test' ) , {
56
+ code : 'ERR_INVALID_ARG_TYPE' ,
57
+ name : 'TypeError' ,
58
+ message : 'The "test" argument must be an instance of Array. Received type ' +
59
+ "string ('foo')"
60
+ }
61
+ ) ;
62
+
63
+ assert . throws (
64
+ ( ) => assertIsArray ( { } , 'test' ) , {
65
+ code : 'ERR_INVALID_ARG_TYPE' ,
66
+ name : 'TypeError' ,
67
+ message : 'The "test" argument must be an instance of Array. Received an instance of Object'
68
+ }
69
+ ) ;
70
+
71
+ assert . throws (
72
+ ( ) => assertIsArray ( 1 , 'test' ) , {
73
+ code : 'ERR_INVALID_ARG_TYPE' ,
74
+ name : 'TypeError' ,
75
+ message : 'The "test" argument must be an instance of Array. Received type ' +
76
+ 'number (1)'
77
+ }
78
+ ) ;
79
+
80
+ assertIsArray ( [ ] , 'test' ) ;
You can’t perform that action at this time.
0 commit comments