Unit testing

From rnavarych/alpha-engineer · View interactive version

Unit testing is an AI agent skill from the GitHub repository rnavarych/alpha-engineer. Unit testing patterns: Vitest config with v8 coverage, Testing Library behavior testing, MSW for HTTP mocking (vs jest.mock), it.each parametrized tests, spies vs mocks vs stubs, testing async code, snapshot testing guidelines. Use when writing unit and component tests.

How to use this skill

Skill file

Unit Testing Patterns

When to use

Core principles

  1. Test behavior, not implementation — what does it return/do, not how
  2. MSW over jest.mock — mock at network level, not module level
  3. One assertion per test — single reason to fail per test
  4. Arrange-Act-Assert — consistent structure in every test
  5. No test interdependence — each test must run independently

References available

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.