Closed zhouzhongyuan closed 7 years ago
What do you mean by Mock Fetch? If youre trying to use a library that mocks fetch()
, then yes that should work fine.
Yes, I mean using a library to mock fetch()
.
I am using react-native-fetch-mock to mocks fetch()
now. But its return value is not a Response, its return value is json.
As I know, React-native doesn't have a Response constructor. Every method trying to mocks fetch()
won't return a right value in Response type. Is it mean I can't mock fetch()
properly? Do you have any good library to mock fetch()
?
Thank you.
I've never used fetch-mock
. But the missing Response
constructor shouldnt matter too much, as you dont actually want to be making a request in your tests.
I dont know of any good libraries, i'd suggest the best solution might be to make your own using mockery.
I'm not sure this is related to this library, so closing until more information can be found.
If no, will it support fetch, and when? If yes, how?