mock-best-practices

Installation
SKILL.md

Follow mocking best practices

Proper mocking isolates units under test while keeping tests realistic—over-mocking creates false confidence when tests pass but production breaks.

Quick Reference

  • Mock external dependencies (APIs, databases, file system), not business logic
  • Always clean up mocks with jest.restoreAllMocks() in afterEach
  • Use MSW for realistic API mocking without coupling to implementation
  • Test behavior and outputs, not internal implementation details

Check

Review this test file for mocking patterns, checking for over-mocking, missing mock cleanup, and proper mock implementation.

Fix

Improve mocking strategy by removing unnecessary mocks, adding proper cleanup, and mocking at the right level of abstraction.

Installs
5
GitHub Stars
73.9K
First Seen
Aug 7, 2026
mock-best-practices — thedaviddias/front-end-checklist