| name | testing-domain |
| description | Write domain and unit tests for the widget host app. Use when testing entities, value objects, invariants, domain services, and application logic with deterministic fixtures. |
Testing Domain
Overview
Validate domain rules and invariants without UI or infrastructure dependencies.
Focus areas
- Entity and value object behavior
- Aggregate invariants
- Domain services
- Application use cases (when pure)
Workflow
- Build fixtures for domain objects.
- Test invariants and edge cases.
- Keep tests fast and deterministic.
- Avoid infrastructure dependencies.
Guidance
- Use builders/factories to reduce test setup noise.
- Prefer explicit assertions over snapshots.
- Name tests after the rule being validated.
References
references/fixtures.mdfor fixture patterns.references/invariant-tests.mdfor invariant coverage.