@@ -44,25 +44,25 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false }));
44
44
[ 'maxHeaderListSize' , - 1 ] ,
45
45
[ 'maxHeaderListSize' , 2 ** 32 ]
46
46
] . forEach ( ( i ) => {
47
- assert . throws ( ( ) => {
47
+ common . expectsError ( ( ) => {
48
48
http2 . getPackedSettings ( { [ i [ 0 ] ] : i [ 1 ] } ) ;
49
- } , common . expectsError ( {
49
+ } , {
50
50
code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
51
51
type : RangeError ,
52
52
message : `Invalid value for setting "${ i [ 0 ] } ": ${ i [ 1 ] } `
53
- } ) ) ;
53
+ } ) ;
54
54
} ) ;
55
55
56
56
[
57
57
1 , null , '' , Infinity , new Date ( ) , { } , NaN , [ false ]
58
58
] . forEach ( ( i ) => {
59
- assert . throws ( ( ) => {
59
+ common . expectsError ( ( ) => {
60
60
http2 . getPackedSettings ( { enablePush : i } ) ;
61
- } , common . expectsError ( {
61
+ } , {
62
62
code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
63
63
type : TypeError ,
64
64
message : `Invalid value for setting "enablePush": ${ i } `
65
- } ) ) ;
65
+ } ) ;
66
66
} ) ;
67
67
68
68
{
@@ -99,23 +99,23 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false }));
99
99
0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x01 ] ) ;
100
100
101
101
[ 1 , true , '' , [ ] , { } , NaN ] . forEach ( ( i ) => {
102
- assert . throws ( ( ) => {
102
+ common . expectsError ( ( ) => {
103
103
http2 . getUnpackedSettings ( i ) ;
104
- } , common . expectsError ( {
104
+ } , {
105
105
code : 'ERR_INVALID_ARG_TYPE' ,
106
106
type : TypeError ,
107
107
message :
108
108
'The "buf" argument must be one of type Buffer, TypedArray, or DataView'
109
- } ) ) ;
109
+ } ) ;
110
110
} ) ;
111
111
112
- assert . throws ( ( ) => {
112
+ common . expectsError ( ( ) => {
113
113
http2 . getUnpackedSettings ( packed . slice ( 5 ) ) ;
114
- } , common . expectsError ( {
114
+ } , {
115
115
code : 'ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH' ,
116
116
type : RangeError ,
117
117
message : 'Packed settings length must be a multiple of six'
118
- } ) ) ;
118
+ } ) ;
119
119
120
120
const settings = http2 . getUnpackedSettings ( packed ) ;
121
121
@@ -160,24 +160,24 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false }));
160
160
{
161
161
const packed = Buffer . from ( [ 0x00 , 0x05 , 0x01 , 0x00 , 0x00 , 0x00 ] ) ;
162
162
163
- assert . throws ( ( ) => {
163
+ common . expectsError ( ( ) => {
164
164
http2 . getUnpackedSettings ( packed , { validate : true } ) ;
165
- } , common . expectsError ( {
165
+ } , {
166
166
code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
167
167
type : RangeError ,
168
168
message : 'Invalid value for setting "maxFrameSize": 16777216'
169
- } ) ) ;
169
+ } ) ;
170
170
}
171
171
172
172
// check for maxConcurrentStreams failing the max number
173
173
{
174
174
const packed = Buffer . from ( [ 0x00 , 0x03 , 0xFF , 0xFF , 0xFF , 0xFF ] ) ;
175
175
176
- assert . throws ( ( ) => {
176
+ common . expectsError ( ( ) => {
177
177
http2 . getUnpackedSettings ( packed , { validate : true } ) ;
178
- } , common . expectsError ( {
178
+ } , {
179
179
code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
180
180
type : RangeError ,
181
181
message : 'Invalid value for setting "maxConcurrentStreams": 4294967295'
182
- } ) ) ;
182
+ } ) ;
183
183
}
0 commit comments