Design unit tests and edge assertions in Claude Code
Use Arrange, Act, and Assert for small tests, and select broader integration and end-to-end checks when a user flow needs them.
中文Install in Claude Code
A Claude Code project with a function whose behavior is known. This example tests only local array filtering.
- Review `.claude/skills/testing/SKILL.md` and its requirements at the pinned GitHub commit.
- Create `.claude/skills/testing/` in your project and save the reviewed file as `.claude/skills/testing/SKILL.md`.
- Start Claude Code from that project's root, then select `/testing` in the slash menu.
Example task
Test the rehearsal venue filter with `{events:['Hall','Garden'],venue:'Hall',emptyInput:[]}`. Choosing Hall retains just Hall, and passing an empty event list returns an empty result.What to check
Use two unit tests. Arrange the fixture, run the filter, and assert `['Hall']`. Check the empty input separately with `empty=true`. Keep the test data independent.
Original SKILL.md on GitHub · Updated
Frequently asked question
Why use separate tests for the happy path and the empty list?
Different inputs have different outcomes. Give each test its own arrange, call, and assertion so it is clear which rule failed. Save cross-module and full user flows for their test levels.