mswjs / examples

Examples of Mock Service Worker usage with various frameworks and libraries.
685 stars 211 forks source link

Showcase runtime handlers in E2E examples #104

Open nergro opened 9 months ago

nergro commented 9 months ago

In the Remix + MSW example there is only one example with handlers that return 200. But how should MSW be used with handlers that return 400, 500? It's not clear how to use resetHandlers() or dynamic mock scenarios within a Remix app.

Trying to import ant reset handlers in a test doesn't work, because the server instance is only working within a entry.server.tsx file.

kettanaito commented 8 months ago

Hi, @nergro. This is a fantastic suggestion. I think where the examples fall flat right now is that they don't mention how to use request handler overrides (.use()). We need to add at least one example of a response override to each example.