From 4dd8dbc253d2925810dac37ed0ba2f6cda23e731 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 8 Dec 2021 19:38:03 +0000 Subject: [PATCH] Fixing server rest test case. --- .../src/integrations/tests/rest.spec.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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"}', }) }) })