@@ -209,7 +209,6 @@ describe('createRequestListener', () => {
209
209
it ( 'handles backpressure when writing response chunks' , async ( ) => {
210
210
await new Promise < void > ( ( resolve ) => {
211
211
let handler : FetchHandler = async ( ) => {
212
- // Create a response with multiple chunks
213
212
let chunks = [ 'chunk1' , 'chunk2' , 'chunk3' , 'chunk4' , 'chunk5' ] ;
214
213
let body = new ReadableStream ( {
215
214
async start ( controller ) {
@@ -219,6 +218,7 @@ describe('createRequestListener', () => {
219
218
controller . close ( ) ;
220
219
} ,
221
220
} ) ;
221
+
222
222
return new Response ( body ) ;
223
223
} ;
224
224
@@ -227,7 +227,6 @@ describe('createRequestListener', () => {
227
227
228
228
let req = createMockRequest ( ) ;
229
229
230
- // Create a custom mock response that properly extends EventEmitter
231
230
let writtenChunks : Uint8Array [ ] = [ ] ;
232
231
let writeCallCount = 0 ;
233
232
let drainListenerCalled = false ;
@@ -245,18 +244,16 @@ describe('createRequestListener', () => {
245
244
setTimeout ( ( ) => {
246
245
writable . emit ( 'drain' ) ;
247
246
} , 0 ) ;
248
- return false ; // Indicate buffer is full
247
+ return false ; // Buffer is full
249
248
}
250
- return true ; // Indicate buffer has space
249
+ return true ; // Buffer has space
251
250
} ,
252
251
end ( ) {
253
252
assert . equal ( writtenChunks . length , 5 ) ;
254
253
assert . equal ( writeCallCount , 5 ) ;
255
254
256
- // Verify backpressure was handled
257
255
assert . ok ( drainListenerCalled , 'drain listener should have been registered' ) ;
258
256
259
- // Verify chunk contents
260
257
let receivedText = writtenChunks . map ( ( chunk ) => new TextDecoder ( ) . decode ( chunk ) ) . join ( '' ) ;
261
258
assert . equal ( receivedText , 'chunk1chunk2chunk3chunk4chunk5' ) ;
262
259
0 commit comments