·5 min read
Testing without mocking fetch by hand, again
The mock client swaps in for your real one with the same method signatures, so your components and tests don't know or care the network isn't real.
2 posts
The mock client swaps in for your real one with the same method signatures, so your components and tests don't know or care the network isn't real.
Set up Vitest with jsdom and globals, then test three layers: a Zod schema, a React form with Testing Library, and a serverless handler by mocking the Resend constructor.