@@ -144,7 +144,7 @@ describe('MockAgent - dispatch', () => {
144
144
} )
145
145
146
146
test ( 'should throw if handler is not valid on redirect' , ( t ) => {
147
- t = tspl ( t , { plan : 7 } )
147
+ t = tspl ( t , { plan : 6 } )
148
148
149
149
const baseUrl = 'http://localhost:9999'
150
150
@@ -168,24 +168,13 @@ describe('MockAgent - dispatch', () => {
168
168
onConnect : 'INVALID'
169
169
} ) , new InvalidArgumentError ( 'invalid onConnect method' ) )
170
170
171
- t . throws ( ( ) => mockAgent . dispatch ( {
172
- origin : baseUrl ,
173
- path : '/foo' ,
174
- method : 'GET'
175
- } , {
176
- onError : ( err ) => { throw err } ,
177
- onConnect : ( ) => { } ,
178
- onBodySent : 'INVALID'
179
- } ) , new InvalidArgumentError ( 'invalid onBodySent method' ) )
180
-
181
171
t . throws ( ( ) => mockAgent . dispatch ( {
182
172
origin : baseUrl ,
183
173
path : '/foo' ,
184
174
method : 'CONNECT'
185
175
} , {
186
176
onError : ( err ) => { throw err } ,
187
177
onConnect : ( ) => { } ,
188
- onBodySent : ( ) => { } ,
189
178
onUpgrade : 'INVALID'
190
179
} ) , new InvalidArgumentError ( 'invalid onUpgrade method' ) )
191
180
@@ -196,7 +185,6 @@ describe('MockAgent - dispatch', () => {
196
185
} , {
197
186
onError : ( err ) => { throw err } ,
198
187
onConnect : ( ) => { } ,
199
- onBodySent : ( ) => { } ,
200
188
onHeaders : 'INVALID'
201
189
} ) , new InvalidArgumentError ( 'invalid onHeaders method' ) )
202
190
@@ -207,7 +195,6 @@ describe('MockAgent - dispatch', () => {
207
195
} , {
208
196
onError : ( err ) => { throw err } ,
209
197
onConnect : ( ) => { } ,
210
- onBodySent : ( ) => { } ,
211
198
onHeaders : ( ) => { } ,
212
199
onData : 'INVALID'
213
200
} ) , new InvalidArgumentError ( 'invalid onData method' ) )
@@ -219,7 +206,6 @@ describe('MockAgent - dispatch', () => {
219
206
} , {
220
207
onError : ( err ) => { throw err } ,
221
208
onConnect : ( ) => { } ,
222
- onBodySent : ( ) => { } ,
223
209
onHeaders : ( ) => { } ,
224
210
onData : ( ) => { } ,
225
211
onComplete : 'INVALID'
@@ -789,8 +775,13 @@ test('MockAgent - handle delays to simulate work', async (t) => {
789
775
790
776
const response = await getResponse ( body )
791
777
t . strictEqual ( response , 'hello' )
778
+ << < << << HEAD
792
779
const elapsedInMs = Math . ceil ( process . hrtime ( start ) [ 1 ] / 1e6 )
793
780
t . ok ( elapsedInMs >= 50 , `Elapsed time is not greater than 50ms: ${ elapsedInMs } ` )
781
+ === = ===
782
+ const elapsedInMs = process . hrtime ( start ) [ 1 ] / 1e6
783
+ t . ok ( elapsedInMs >= 49 , `Elapsed time is not greater than 50ms: ${ elapsedInMs } ` )
784
+ >>> > >>> ddabe919 . . . remove anti - pattern dispatcher hooks ( #2723 )
794
785
} )
795
786
796
787
test ( 'MockAgent - should persist requests' , async ( t ) => {
0 commit comments