studio-mock-api-tests
Installation
SKILL.md
Studio MSW component tests
Mount a Studio component, intercept its network calls with MSW, assert what renders and what gets sent. The infrastructure is already wired up — this skill is the working template plus the gotchas.
When to use
- The component (or any descendant it renders) calls a React Query hook
or mutation that hits
/platform/...,/v1/..., or another endpoint inapps/studio/data/api.d.ts. - You'd otherwise be tempted to write
vi.mock('@/data/some-query', ...). Don't. Mock the network instead — see "Why not vi.mock" below.
If the component is purely presentational with no data fetching, you don't need MSW; render and assert directly.