Cilla
Cilla•2y ago

API tests

What's the latest take on API tests? I've read "Testing React Components with Convex" (https://stack.convex.dev/testing-react-components-with-convex), but I'm wondering: Is there a way to test my mutation and query functions directly? Eg not using the strategies suggested in the article Method 1. replace the internal useQuery and useMutation or Method 2. use dependency injection. Thanks!
2 Replies
Michal Srb
Michal Srb•2y ago
Hey @Cilla, we're still working on a proper testing harness for testing functions. You could set up a simple mock yourself that replaces ctx.db with a dummy implementation for example. Hopefully we'll provide such a mock soon ourselves.
Cilla
CillaOP•2y ago
Thanks @Michal Srb I'll keep my 👀 open for testing updates!

Did you find this page helpful?