Fixing server rest test case.
This commit is contained in:
parent
04114594bf
commit
80ed9e25f3
|
@ -24,6 +24,7 @@ describe("REST Integration", () => {
|
||||||
config = new TestConfiguration({
|
config = new TestConfiguration({
|
||||||
url: BASE_URL,
|
url: BASE_URL,
|
||||||
})
|
})
|
||||||
|
jest.clearAllMocks()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("calls the create method with the correct params", async () => {
|
it("calls the create method with the correct params", async () => {
|
||||||
|
@ -33,9 +34,10 @@ describe("REST Integration", () => {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
json: {
|
bodyType: "json",
|
||||||
|
requestBody: JSON.stringify({
|
||||||
name: "test",
|
name: "test",
|
||||||
},
|
}),
|
||||||
}
|
}
|
||||||
const response = await config.integration.create(query)
|
const response = await config.integration.create(query)
|
||||||
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
||||||
|
@ -60,6 +62,7 @@ describe("REST Integration", () => {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "text/html",
|
Accept: "text/html",
|
||||||
},
|
},
|
||||||
|
method: "GET",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -70,13 +73,14 @@ describe("REST Integration", () => {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
json: {
|
bodyType: "json",
|
||||||
|
requestBody: JSON.stringify({
|
||||||
name: "test",
|
name: "test",
|
||||||
},
|
}),
|
||||||
}
|
}
|
||||||
const response = await config.integration.update(query)
|
const response = await config.integration.update(query)
|
||||||
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
||||||
method: "POST",
|
method: "PUT",
|
||||||
body: '{"name":"test"}',
|
body: '{"name":"test"}',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
|
@ -91,9 +95,10 @@ describe("REST Integration", () => {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
json: {
|
bodyType: "json",
|
||||||
|
requestBody: JSON.stringify({
|
||||||
name: "test",
|
name: "test",
|
||||||
},
|
}),
|
||||||
}
|
}
|
||||||
const response = await config.integration.delete(query)
|
const response = await config.integration.delete(query)
|
||||||
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
||||||
|
@ -101,6 +106,7 @@ describe("REST Integration", () => {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
|
body: '{"name":"test"}',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue