@@ -209,7 +209,6 @@ describe('createRequestListener', () => {
209209 it ( 'handles backpressure when writing response chunks' , async ( ) => {
210210 await new Promise < void > ( ( resolve ) => {
211211 let handler : FetchHandler = async ( ) => {
212- // Create a response with multiple chunks
213212 let chunks = [ 'chunk1' , 'chunk2' , 'chunk3' , 'chunk4' , 'chunk5' ] ;
214213 let body = new ReadableStream ( {
215214 async start ( controller ) {
@@ -219,6 +218,7 @@ describe('createRequestListener', () => {
219218 controller . close ( ) ;
220219 } ,
221220 } ) ;
221+
222222 return new Response ( body ) ;
223223 } ;
224224
@@ -227,7 +227,6 @@ describe('createRequestListener', () => {
227227
228228 let req = createMockRequest ( ) ;
229229
230- // Create a custom mock response that properly extends EventEmitter
231230 let writtenChunks : Uint8Array [ ] = [ ] ;
232231 let writeCallCount = 0 ;
233232 let drainListenerCalled = false ;
@@ -245,18 +244,16 @@ describe('createRequestListener', () => {
245244 setTimeout ( ( ) => {
246245 writable . emit ( 'drain' ) ;
247246 } , 0 ) ;
248- return false ; // Indicate buffer is full
247+ return false ; // Buffer is full
249248 }
250- return true ; // Indicate buffer has space
249+ return true ; // Buffer has space
251250 } ,
252251 end ( ) {
253252 assert . equal ( writtenChunks . length , 5 ) ;
254253 assert . equal ( writeCallCount , 5 ) ;
255254
256- // Verify backpressure was handled
257255 assert . ok ( drainListenerCalled , 'drain listener should have been registered' ) ;
258256
259- // Verify chunk contents
260257 let receivedText = writtenChunks . map ( ( chunk ) => new TextDecoder ( ) . decode ( chunk ) ) . join ( '' ) ;
261258 assert . equal ( receivedText , 'chunk1chunk2chunk3chunk4chunk5' ) ;
262259
0 commit comments