| semantic-links |
|
|---|
Use this catalog when generated or existing test code is correct but does not clearly communicate the behavior it protects. Entries describe reviewed, repository-native patterns; they complement the mandatory conventions in the unit-test skill.
| Pattern | Use it when | Representative source |
|---|---|---|
| Scenario fixture with independent expected outputs | One domain input must be verified through multiple independently decoded response representations. | packages/axum-http-server/src/v1/handlers/announce.rs |
| Scenario fixtures for causal initial state | Several setup operations establish the one state that makes the Act behave differently. | packages/axum-http-server/src/server.rs |
| Prose-first Arrange-Act-Assert verification | A correct test is hard to read because its code does not yet express its behavioral intent. | packages/udp-server/src/handlers/mod.rs |
| Named helpers for abstraction-level alignment | A coherent setup action is obscured by low-level mechanics or rejected only because it has one caller. | packages/udp-server/tests/server/contract.rs |
| Pure decision function for collaborator-observed outcomes | A module's own decision is only observable through a collaborator's answer, so its unit tests silently depend on that collaborator. | packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs |
Each entry must include:
- The readability or maintainability problem that triggered the refactor.
- The selected pattern and its essential constraints.
- Appropriate and inappropriate uses.
- A repository source example and its originating issue, when applicable.
- How the pattern preserves deterministic execution and one behavior-focused contract.