Skip to content
Control UIalpha
Skill / React code quality

Real stack tests

Prefer tests that drive production hooks, clients, routing, and cache behavior with only the network mocked.

Goal

Make a green test prove the real UI path, not a mocked copy of the implementation.

Review rules for component structure, state ownership, data fetching, and render behavior.

Checks

1Render through the real provider stack when the component depends on cache, router, or client behavior.
2Mock network responses at the boundary and use production response types where available.
3Assert behavior visible to the user rather than duplicating implementation class strings or hook internals.

Avoid

1vi.mock for local hooks, services, auth gates, or SDK calls that the component is meant to exercise.
2Bespoke test-only data shapes that drift from production response types.

Source

Imported as local Control UI skill guidance, with this repo owning the final wording.

Mastra react-best-practices
../mastra/.claude/skills/react-best-practices