Closed GeoffreyPlitt closed 7 years ago
I did not know about this global, and I don't believe it's documented. Do you know what it does? So we can make an accurate mock
Seems like it's inspired by the browser FormData
API: https://developer.mozilla.org/en-US/docs/Web/API/FormData
Here's the react-native implementation: https://github.com/facebook/react-native/blob/9ee815f6b52e0c2417c04e5a05e1e31df26daed2/Libraries/Network/FormData.js
Ah ok. Looks like it's something that's very easy to add
Sweet
I have a several issue with RNGoogleSignin
component. I extended the current package in an initial config file similar to following, is there anything wrong with this approach I was getting an error while trying to run tests due to missign RNGoogleSignin
:
import ReactNativeMock from "react-native-mock";
import "react-native-mock/mock";
ReactNativeMock.NativeModules.RNGoogleSignin = {};
@cubbuk You probably shouldnt do it like that. If you just run the mock script. then extend NativeModules off react-naive instead of react-native-mock, it should work
@RealOrangeOne But isn't the idea of ReactNativeMock
is to replace import
statements to ReactNative
to point to itself? If I extend ReactNative
rather than the mock, the require statements on missing components will throw exception. Maybe I am just confused about the library let me know If I didn't make sense.
I think you may be. We're changing the require path yes. But you shouldnt be mutating our library directly. You should be running mock, the changing react-native itself afterwards.
Is there any reason this isn't as simple as just adding the React Native implementation to react-native-mock? If that's all that's required, I'm happy to put together a PR.
@taylesworth Yes, it should be just that simple. Provided it's mocked in an identical way.
Do you have an eta for a release containing FormData?
Hello,
The (real) React-Native has a global "FormData" defined. This module doesn't seem to provide that?