test: fix fetch related tests
This commit is contained in:
9
server/__mocks__/fetch-with-proxy.ts
Normal file
9
server/__mocks__/fetch-with-proxy.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import fetchMock from "jest-fetch-mock";
|
||||||
|
|
||||||
|
fetchMock.enableMocks();
|
||||||
|
|
||||||
|
// changes default behavior of fetchMock to use the real 'fetch' implementation.
|
||||||
|
// Mocks can now be enabled in each individual test with fetchMock.doMock()
|
||||||
|
fetchMock.dontMock();
|
||||||
|
|
||||||
|
export default fetch;
|
||||||
@@ -14,12 +14,11 @@ beforeEach(() => flushdb());
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
|
fetchMock.doMock();
|
||||||
});
|
});
|
||||||
|
|
||||||
const ip = "127.0.0.1";
|
const ip = "127.0.0.1";
|
||||||
|
|
||||||
fetchMock.enableMocks();
|
|
||||||
|
|
||||||
describe("DeliverWebhookTask", () => {
|
describe("DeliverWebhookTask", () => {
|
||||||
test("should hit the subscription url and record a delivery", async () => {
|
test("should hit the subscription url and record a delivery", async () => {
|
||||||
const subscription = await buildWebhookSubscription({
|
const subscription = await buildWebhookSubscription({
|
||||||
|
|||||||
Reference in New Issue
Block a user