How are you able to use the useRelayEnvironment hook in your tests? Do you not get an invalid hook call error? How does the <TransactionList /> know what environment to use?
I use createMockEnvironment from react-test-utils. Then I create a barebone component in my tests using QueryRenderer that wraps the component that I am testing, passing the fragment reference down. It's a bit of boilerplate code.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
How are you able to use the
useRelayEnvironment
hook in your tests? Do you not get an invalid hook call error? How does the<TransactionList />
know what environment to use?yea I get the same error, an answer would be nice.
I use
createMockEnvironment
fromreact-test-utils
. Then I create a barebone component in my tests using QueryRenderer that wraps the component that I am testing, passing the fragment reference down. It's a bit of boilerplate code.