kopia lustrzana https://gitlab.com/rysiekpl/libresilient
fetch plugin test: minor indentation fix
rodzic
5a18502bad
commit
ba129551d4
|
@ -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"})
|
||||
});
|
||||
});
|
||||
|
|
Ładowanie…
Reference in New Issue