Closed taylesworth closed 7 years ago
Thanks for doing this. I don't really like the way it's done. Could you strip out all the special defineProperty stuff that's just copied from react-native, and just use Object.assign on global directly. It's a lot of code that really isnt needed. I do like that youre keeping the implementations of the APIs, just the mocking isnt standard. Also, linter is failing
@RealOrangeOne Changes made. I kept InitializeCore.js
but stripped it down to just what was necessary. I thought it would be good to keep those property definitions in a file that corresponds to where they are defined in React Native itself. But I can move them to either react-native.js
or mock.js
if you prefer.
I like this cut down file. But I don't like that it's not really doing what it says. It'd be nice if we could change defineGlobalProperty to be in a utils file in the src dir, then move the uses of it into react-native.js. Keep everything following roughly the same structure
@RealOrangeOne Ready for another look.
I have some tests that rely on network APIs that exist in React Native but not in react-native-mock. This PR adds those APIs and resolves https://github.com/RealOrangeOne/react-native-mock/issues/103.
FormData
Headers
Response
XMLHttpRequest