@@ -146,13 +146,15 @@ describe("pw-session getPageForTargetId", () => {
146146 urls : [ "https://alpha.example" , "https://beta.example" ] ,
147147 } ) . pages ;
148148
149- const fetchSpy = vi . spyOn ( globalThis , "fetch" ) . mockResolvedValue ( {
150- ok : true ,
151- json : async ( ) => [
152- { id : "TARGET_A" , url : "https://alpha.example" } ,
153- { id : "TARGET_B" , url : "https://beta.example" } ,
154- ] ,
155- } as Response ) ;
149+ const fetchSpy = vi . spyOn ( globalThis , "fetch" ) . mockResolvedValue (
150+ new Response (
151+ JSON . stringify ( [
152+ { id : "TARGET_A" , url : "https://alpha.example" } ,
153+ { id : "TARGET_B" , url : "https://beta.example" } ,
154+ ] ) ,
155+ { headers : { "content-type" : "application/json" } } ,
156+ ) ,
157+ ) ;
156158
157159 try {
158160 const resolved = await getPageForTargetId ( {
@@ -180,13 +182,15 @@ describe("pw-session getPageForTargetId", () => {
180182 } ) ;
181183 const [ , pageB ] = pages ;
182184
183- const fetchSpy = vi . spyOn ( globalThis , "fetch" ) . mockResolvedValue ( {
184- ok : true ,
185- json : async ( ) => [
186- { id : "TARGET_A" , url : "https://alpha.example" } ,
187- { id : "TARGET_B" , url : "https://beta.example" } ,
188- ] ,
189- } as Response ) ;
185+ const fetchSpy = vi . spyOn ( globalThis , "fetch" ) . mockResolvedValue (
186+ new Response (
187+ JSON . stringify ( [
188+ { id : "TARGET_A" , url : "https://alpha.example" } ,
189+ { id : "TARGET_B" , url : "https://beta.example" } ,
190+ ] ) ,
191+ { headers : { "content-type" : "application/json" } } ,
192+ ) ,
193+ ) ;
190194
191195 try {
192196 const resolved = await getPageForTargetId ( {
0 commit comments