-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
I'm trying to find a way to seed some apollo client reactive vars (in memory but persisted in async storage) in each test (https://www.apollographql.com/docs/react/local-state/reactive-variables/)
I'm wondering on what the best approach to this would be, im considering:
-
Creating a UI to interface with these variables
I would create a floating button that shows only in dev mode that can be pressed from a detox test, it would open up a modal for writing and reading the in memory vars
1. Open dev UI via button in detox test 2. Write to an input field to create a value in detox test
-
Using a static mock + server
Make a request to a server with the values I want the the reactive vars to be, then in my app have a mock of the function that initialises the vars by making a request to the same server.
1. Make a network request to server with the initial values in detox test 2. Override "initiateReactiveVars.ts" with "initiateReactiveVars.mock.ts" 3. Have the mock initiate the reactiveVars by making a request to the server
Your environment
Detox version: 20
React Native version: 70x
Node version: 15
Device model: Pixel
OS: Android
Test-runner (select one): jest