diff --git a/__tests__/plugins/fetch.test.js b/__tests__/plugins/fetch.test.js index 93bdac3..13bd47b 100644 --- a/__tests__/plugins/fetch.test.js +++ b/__tests__/plugins/fetch.test.js @@ -2,13 +2,13 @@ const makeServiceWorkerEnv = require('service-worker-mock'); global.fetch = require('node-fetch'); jest.mock('node-fetch', () => { - const context = { - then: jest.fn().mockImplementationOnce(() => { - const response = { test: "success" }; - return Promise.resolve(response); - }) - }; - return jest.fn(() => context); + const context = { + then: jest.fn().mockImplementation(() => { + const response = { test: "success" }; + return Promise.resolve(response); + }) + }; + return jest.fn(() => context); }); describe("plugin: fetch", () => { @@ -34,6 +34,7 @@ describe("plugin: fetch", () => { require("../../plugins/fetch.js"); const returnedJSON = await self.LibResilientPlugins[0].fetch('https://resilient.is/test.json'); + expect(fetch).toHaveBeenCalled(); expect(returnedJSON).toEqual({test: "success"}) }); });