-
I can not wrap my head around how to test the functions provided by my chain of ContextProviders in React-Native properly. All the sources I found are either using mocking build-in context functions only spying on those being called, but I want to properly test them, like any other unit. Now the first Component in question looks (very simplified) like this:
Now regarding the tests that's how far I could get it before running into troubles with the context and custom export methods (here getNodes):
As you can see, I apply the config for realm based on a variable and use api.testConfig instead of api.ontologyConfig but beside this, I want it to behave identically to how it would when used by other components. My problem is that my test component does not get the update of ontologyIsInitialized being changed to true after initialization of the provider.
which is confusing because I do call waitFor and act with await! Beside this is there any other way to test the methods exported via useOntology directly? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You could pass the realm configuration as a prop. |
Beta Was this translation helpful? Give feedback.
-
YEAH, i found the solution, and its quite simple:
|
Beta Was this translation helpful? Give feedback.
YEAH, i found the solution, and its quite simple: