1
0
Fork 0
mirror of synced 2024-07-09 08:16:34 +12:00

Fixing server rest test case.

This commit is contained in:
mike12345567 2021-12-08 19:38:03 +00:00
parent bbb5501d41
commit 4dd8dbc253

View file

@ -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"}',
})
})
})