18 lines
866 B
Plaintext
18 lines
866 B
Plaintext
---
|
||
description: Testing standards — structure, naming, and what to cover
|
||
globs: **/*.{test,spec}.{ts,tsx,js,jsx,py}
|
||
alwaysApply: false
|
||
---
|
||
|
||
# Testing Standards
|
||
|
||
- Test behavior, not implementation details. Assert outputs and side effects users care about.
|
||
- Follow Arrange–Act–Assert (or Given–When–Then) structure.
|
||
- One assertion concept per test. Name tests: `should <expected> when <condition>`.
|
||
- Cover happy path, edge cases, and at least one failure case per feature.
|
||
- Mock external services (APIs, DB, email) — never call real third parties in unit tests.
|
||
- Do not test framework internals or trivial getters with no logic.
|
||
- Keep tests independent: no shared mutable state between tests.
|
||
- Prefer factory helpers or fixtures over copy-pasted setup blocks.
|
||
- Flaky tests are bugs — fix or delete them, do not `@skip` without a tracked issue.
|