@@ -312,7 +312,7 @@ describe('query params are parsed', () => {
312312
313313
314314describe ( 'turbostream' , ( ) => {
315- test ( 'turbo fetch is called for turbo-stream responseKind ' , async ( ) => {
315+ test ( 'turbo fetch is called when available ' , async ( ) => {
316316 const mockResponse = new Response ( "success!" , { status : 200 } )
317317
318318 window . fetch = jest . fn ( ) . mockResolvedValue ( mockResponse )
@@ -326,16 +326,15 @@ describe('turbostream', () => {
326326 expect ( testResponse ) . toStrictEqual ( new FetchResponse ( mockResponse ) )
327327 } )
328328
329- test ( 'turbo fetch is called for other responseKind ' , async ( ) => {
329+ test ( 'turbo fetch is not called when not available ' , async ( ) => {
330330 const mockResponse = new Response ( "success!" , { status : 200 } )
331331
332332 window . fetch = jest . fn ( ) . mockResolvedValue ( mockResponse )
333- window . Turbo = { fetch : jest . fn ( ) . mockResolvedValue ( mockResponse ) }
333+ window . Turbo = undefined
334334
335- const testRequest = new FetchRequest ( "get" , "localhost" )
335+ const testRequest = new FetchRequest ( "get" , "localhost" , { responseKind : 'turbo-stream' } )
336336 const testResponse = await testRequest . perform ( )
337337
338- expect ( window . Turbo . fetch ) . toHaveBeenCalledTimes ( 0 )
339338 expect ( window . fetch ) . toHaveBeenCalledTimes ( 1 )
340339 expect ( testResponse ) . toStrictEqual ( new FetchResponse ( mockResponse ) )
341340 } )
0 commit comments