diff --git a/packages/inngest/src/components/Inngest.test.ts b/packages/inngest/src/components/Inngest.test.ts index 6bd977c69..ba2cb3be4 100644 --- a/packages/inngest/src/components/Inngest.test.ts +++ b/packages/inngest/src/components/Inngest.test.ts @@ -494,22 +494,31 @@ describe("send", () => { }); test("should return error from Inngest if parsed", () => { - global.fetch = setFetch({ status: 400, error: "Test Error" }); - const inngest = createClient({ id: "test", eventKey: testEventKey }); + const inngest = createClient({ + id: "test", + eventKey: testEventKey, + fetch: setFetch({ status: 400, error: "Test Error" }), + }); return expect(inngest.send(testEvent)).rejects.toThrowError("Test Error"); }); test("should return error from Inngest if parsed even for 200", () => { - global.fetch = setFetch({ status: 200, error: "Test Error" }); - const inngest = createClient({ id: "test", eventKey: testEventKey }); + const inngest = createClient({ + id: "test", + eventKey: testEventKey, + fetch: setFetch({ status: 200, error: "Test Error" }), + }); return expect(inngest.send(testEvent)).rejects.toThrowError("Test Error"); }); test("should return error if bad status code with no error string", () => { - global.fetch = setFetch({ status: 400 }); - const inngest = createClient({ id: "test", eventKey: testEventKey }); + const inngest = createClient({ + id: "test", + eventKey: testEventKey, + fetch: setFetch({ status: 400 }), + }); return expect(inngest.send(testEvent)).rejects.toThrowError( "Cannot process event payload" @@ -517,8 +526,11 @@ describe("send", () => { }); test("should return unknown error from response text if very bad status code", () => { - global.fetch = setFetch({ status: 600 }); - const inngest = createClient({ id: "test", eventKey: testEventKey }); + const inngest = createClient({ + id: "test", + eventKey: testEventKey, + fetch: setFetch({ status: 600 }), + }); return expect(inngest.send(testEvent)).rejects.toThrowError("600"); });