@@ -44,25 +44,25 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false }));
4444 [ 'maxHeaderListSize' , - 1 ] ,
4545 [ 'maxHeaderListSize' , 2 ** 32 ]
4646] . forEach ( ( i ) => {
47- assert . throws ( ( ) => {
47+ common . expectsError ( ( ) => {
4848 http2 . getPackedSettings ( { [ i [ 0 ] ] : i [ 1 ] } ) ;
49- } , common . expectsError ( {
49+ } , {
5050 code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
5151 type : RangeError ,
5252 message : `Invalid value for setting "${ i [ 0 ] } ": ${ i [ 1 ] } `
53- } ) ) ;
53+ } ) ;
5454} ) ;
5555
5656[
5757 1 , null , '' , Infinity , new Date ( ) , { } , NaN , [ false ]
5858] . forEach ( ( i ) => {
59- assert . throws ( ( ) => {
59+ common . expectsError ( ( ) => {
6060 http2 . getPackedSettings ( { enablePush : i } ) ;
61- } , common . expectsError ( {
61+ } , {
6262 code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
6363 type : TypeError ,
6464 message : `Invalid value for setting "enablePush": ${ i } `
65- } ) ) ;
65+ } ) ;
6666} ) ;
6767
6868{
@@ -99,23 +99,23 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false }));
9999 0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x01 ] ) ;
100100
101101 [ 1 , true , '' , [ ] , { } , NaN ] . forEach ( ( i ) => {
102- assert . throws ( ( ) => {
102+ common . expectsError ( ( ) => {
103103 http2 . getUnpackedSettings ( i ) ;
104- } , common . expectsError ( {
104+ } , {
105105 code : 'ERR_INVALID_ARG_TYPE' ,
106106 type : TypeError ,
107107 message :
108108 'The "buf" argument must be one of type Buffer, TypedArray, or DataView'
109- } ) ) ;
109+ } ) ;
110110 } ) ;
111111
112- assert . throws ( ( ) => {
112+ common . expectsError ( ( ) => {
113113 http2 . getUnpackedSettings ( packed . slice ( 5 ) ) ;
114- } , common . expectsError ( {
114+ } , {
115115 code : 'ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH' ,
116116 type : RangeError ,
117117 message : 'Packed settings length must be a multiple of six'
118- } ) ) ;
118+ } ) ;
119119
120120 const settings = http2 . getUnpackedSettings ( packed ) ;
121121
@@ -160,24 +160,24 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false }));
160160{
161161 const packed = Buffer . from ( [ 0x00 , 0x05 , 0x01 , 0x00 , 0x00 , 0x00 ] ) ;
162162
163- assert . throws ( ( ) => {
163+ common . expectsError ( ( ) => {
164164 http2 . getUnpackedSettings ( packed , { validate : true } ) ;
165- } , common . expectsError ( {
165+ } , {
166166 code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
167167 type : RangeError ,
168168 message : 'Invalid value for setting "maxFrameSize": 16777216'
169- } ) ) ;
169+ } ) ;
170170}
171171
172172// check for maxConcurrentStreams failing the max number
173173{
174174 const packed = Buffer . from ( [ 0x00 , 0x03 , 0xFF , 0xFF , 0xFF , 0xFF ] ) ;
175175
176- assert . throws ( ( ) => {
176+ common . expectsError ( ( ) => {
177177 http2 . getUnpackedSettings ( packed , { validate : true } ) ;
178- } , common . expectsError ( {
178+ } , {
179179 code : 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
180180 type : RangeError ,
181181 message : 'Invalid value for setting "maxConcurrentStreams": 4294967295'
182- } ) ) ;
182+ } ) ;
183183}
0 commit comments