diff --git a/src/link/persisted-queries/__tests__/persisted-queries.test.ts b/src/link/persisted-queries/__tests__/persisted-queries.test.ts index 37fc4c9c476..a36ac5f1f05 100644 --- a/src/link/persisted-queries/__tests__/persisted-queries.test.ts +++ b/src/link/persisted-queries/__tests__/persisted-queries.test.ts @@ -563,11 +563,11 @@ describe("failure path", () => { const fetcher = (...args: any[]) => { if (++requestCount % 2) { - return Promise.resolve({ - json: () => Promise.resolve(errorResponseWithCode), - text: () => Promise.resolve(errorResponseWithCode), - status, - }); + return Promise.resolve( + new Response(errorResponseWithCode, { + status, + }) + ); } return global.fetch.apply(null, args); }; @@ -617,11 +617,7 @@ describe("failure path", () => { const fetcher = (...args: any[]) => { if (!failed) { failed = true; - return Promise.resolve({ - json: () => Promise.resolve("This will blow up"), - text: () => Promise.resolve("THIS WILL BLOW UP"), - status, - }); + return Promise.resolve(new Response("THIS WILL BLOW UP", { status })); } return global.fetch.apply(null, args); }; @@ -656,11 +652,7 @@ describe("failure path", () => { const fetcher = (...args: any[]) => { if (!failed) { failed = true; - return Promise.resolve({ - json: () => Promise.resolve(errorResponse), - text: () => Promise.resolve(errorResponse), - status, - }); + return Promise.resolve(new Response(errorResponse, { status })); } return global.fetch.apply(null, args); };