Why is error
undefined during tests?
#2806
Unanswered
IPWright83
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to write a test around a hook using SWR. The test looks something like this:
What I'm finding (and I'm wondering if someone could explain why) is that
error.message
is undefined... that is unless Iget
the value within the hook itself. So:this works
However if I remove the access to
result.error
in the return, to simply just returnresult
, orreturn useSWR
directly, then error is always undefined during the test.Can anyone explain why this is as I don't understand 😢
Beta Was this translation helpful? Give feedback.
All reactions