Yvens
Yvens8mo ago

Mock Service Worker implementation

Hello guys, I'm giving a go at MSW, and I'm not sure about the implementation. The way I do it feel strange to me does anyone could give it a look and let me know if it makes sense ? Link of the gist: https://gist.github.com/Yvens16/bdd3cabd79bdc73791f7342f280a955d
Gist
Mock Service Worker + Convex
Mock Service Worker + Convex. GitHub Gist: instantly share code, notes, and snippets.
3 Replies
Michal Srb
Michal Srb8mo ago
@Yvens what is this for, are you trying to test React code or something else?
Yvens
YvensOP8mo ago
@Michal Srb Yes I’m trying to test my logic in response to an api call in my react code
Michal Srb
Michal Srb8mo ago
I would either: 1. Mock useQuery, useMutation etc. 2. Use https://github.com/get-convex/convex-helpers/tree/main/src/fakeConvexClient Let me know how it goes for you.
GitHub
convex-helpers/src/fakeConvexClient at main · get-convex/convex-hel...
A collection of useful code to complement the official packages. - get-convex/convex-helpers

Did you find this page helpful?