robinpowered / react-native-fetch-polyfill

Exposes options to React Native's XMLHttpRequest that are not accessible by `whatwg-fetch`
71 stars 23 forks source link

Unable to mock this module #12

Open gourav-singhal opened 5 years ago

gourav-singhal commented 5 years ago

Can you provide a mock implementation of this module for jest testing?

gourav-singhal commented 5 years ago

@zachdunn @samdunn Can you help me out with this? Tried this but it is not working

jest.mock('react-native-fetch-polyfill', () => { fetch: jest.fn().mockImplementation( () => Promise.resolve({ json: () => Promise.resolve(JSON.parse(body)) }), ), })

gourav-singhal commented 5 years ago

Seems like this library is not maintained anymore