diff --git a/packages/server/src/integrations/tests/rest.spec.js b/packages/server/src/integrations/tests/rest.spec.js index 7b128a6d14..99f10ff438 100644 --- a/packages/server/src/integrations/tests/rest.spec.js +++ b/packages/server/src/integrations/tests/rest.spec.js @@ -24,6 +24,7 @@ describe("REST Integration", () => { config = new TestConfiguration({ url: BASE_URL, }) + jest.clearAllMocks() }) it("calls the create method with the correct params", async () => { @@ -33,9 +34,10 @@ describe("REST Integration", () => { headers: { Accept: "application/json", }, - json: { + bodyType: "json", + requestBody: JSON.stringify({ name: "test", - }, + }), } const response = await config.integration.create(query) expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, { @@ -60,6 +62,7 @@ describe("REST Integration", () => { headers: { Accept: "text/html", }, + method: "GET", }) }) @@ -70,13 +73,14 @@ describe("REST Integration", () => { headers: { Accept: "application/json", }, - json: { + bodyType: "json", + requestBody: JSON.stringify({ name: "test", - }, + }), } const response = await config.integration.update(query) expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, { - method: "POST", + method: "PUT", body: '{"name":"test"}', headers: { Accept: "application/json", @@ -91,9 +95,10 @@ describe("REST Integration", () => { headers: { Accept: "application/json", }, - json: { + bodyType: "json", + requestBody: JSON.stringify({ name: "test", - }, + }), } const response = await config.integration.delete(query) expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, { @@ -101,6 +106,7 @@ describe("REST Integration", () => { headers: { Accept: "application/json", }, + body: '{"name":"test"}', }) }) })