v1.15.9
Fix: SDD TDD Agent — Mock Hygiene, Smoke Test Ban, Implementation Detail Coupling
Validated v1.15.8 rules against real deleted tests from prowler-cloud/prowler and found 3 gaps. Now closed.
New Rules (apply + verify)
Mock Hygiene
- Mock/assertion ratio guide: ≤3 mocks ✅, 4-6
⚠️ consider extraction, 7+ ❌ wrong layer - Extract-Before-Mock Rule: if the logic is a data transformation, extract to a pure function and test directly — zero mocks needed
- Example: 15
vi.mock()calls to testMUTED → FAILconversion → extract toresolveDisplayStatus()and test with 0 mocks
Smoke Test Ban
render() + toBeInTheDocument()without behavioral assertions is NOT a valid test- "Renders without crash" does not count toward TDD coverage
- Must assert WHAT was rendered (text, values, states derived from data)
Implementation Detail Coupling Ban
- CSS class assertions (
expect(el.className).toContain("text-xs")) are NEVER valid - Internal state assertions (
component.state.isLoading) are banned - Mock call count assertions (
mock.calls.length === 3) are brittle coupling - Tests must assert user-visible behavior: text content, roles, disabled state
Coverage Matrix (all 7 problems now covered)
| Problem | Status |
|---|---|
| Smoke test only | ✅ Smoke Test Rule |
| Mock/assertion ratio 12:1 | ✅ Mock Hygiene Rules |
| Assertions negativas sin positivas | ✅ Triangulation (v1.15.8) |
| Ghost loops | ✅ Banned Patterns (v1.15.8) |
| CSS implementation detail coupling | ✅ Implementation Detail Rule |
| Extract to pure function | ✅ Extract-Before-Mock |
| Suggest E2E for complex flows | ✅ Choosing Test Layer (existing) |