Testing With React Testing Library #344
Unanswered
greenymcgee
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
Oh, I'm using msw to mock responses. The error does get returned in my server action, and the result does include the error I'm expecting. The client-side callbacks just don't ever fire and |
Beta Was this translation helpful? Give feedback.
2 replies
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 installed next-safe-action, and all is working well in the browser with an
actionClientand theuseActionhook. The client-side callbacks are exactly what I was hoping for. The problem is that I don't seem to be able to test the flow starting from the form submission all the way back to my toast that should happen on success or failure throughonSuccessoronErrorsupplied throughuseActionutils. I wrote some logs in thehooks.mjsfile temporarily to see them both in the browser and in the test environment. What I found is thatexecuteAsync's.finallyruns beforeawait Promise.resolve(onExecute?.({ input }));withinuseActionCallbackswhen in the test environment, but it runs after in the browser. I'm wondering if maybe it's because from the browser it actually hits a server, but in the test environment it doesn't so the execution times aren't a 1:1 match. Has anyone else ran into this?Beta Was this translation helpful? Give feedback.
All reactions