Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Use unmock on device in development #3

Merged
merged 12 commits into from
Dec 20, 2019
Merged

Use unmock on device in development #3

merged 12 commits into from
Dec 20, 2019

Conversation

ksaaskil
Copy link
Contributor

@ksaaskil ksaaskil commented Dec 12, 2019

  • Example of using unmock in running on-device in React Native. In development, where NODE_ENV==="development", switches on Unmock to mock the Cat Facts API.
  • Uses unmock from unmock-browser: this seems to be a safer bet than using unmock package, because using that seems to mess things up when running a development server. unmock-browser only overrides global.fetch or window.fetch and cannot have weird sife-effects of messing up other Node.js stuff (might be worth checking if this can be fixed by adding react-native field in the package.json of unmock

Tricks this required:

Future stuff:

  • Running tests in the virtual device using Unmock?
  • Adding a component for switching Unmock on and off?
  • Adding CircleCI integration

@ksaaskil ksaaskil changed the title Use unmock in development. Use unmock on device Dec 20, 2019
@ksaaskil ksaaskil changed the title Use unmock on device Use unmock on device in development Dec 20, 2019
@ksaaskil ksaaskil merged commit 19cf883 into master Dec 20, 2019
@ksaaskil ksaaskil deleted the add-unmock branch December 20, 2019 10:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant