UNPKG

ld-scheduler

Version:

Schedule launch darkly flags on or off

24 lines (18 loc) 520 B
/** * Global mock for isomorphic-fetch */ const fetch = jest.fn(); const response = (status, statusText, ok, body) => { return { url: '', status, statusText, ok, json: () => body, } }; fetch.mockSuccess = (body, opts = {ok: true, status: 200, statusText: ''}) => fetch.mockImplementationOnce(() => Promise.resolve(response(opts.status, opts.statusText, opts.ok, body))); fetch.mockFailure = (error) => fetch.mockImplementationOnce(() => Promise.reject(error)); export default fetch;