Anti-Pattern 2: Test-Only Methods in Production
**The violation:** ```typescript // ❌ BAD: destroy() only used in tests class Session { async destroy() { // Looks like production API! await this._workspaceManager?.destroyWorkspace(this.id); // ... cleanup } } // In tests afterEach(() => session.destroy()); ``` **Why this is wrong:** - Production class polluted with test-only code - Dangerous if accidentally called in production - Violates YAGNI and separation of concerns - Confuses object lifecycle with entity lifecycle **The fix:** ```typescript // ✅ GOOD: Test utilities handle test cleanup // Session has no destroy() - it's stateless in production // In test-utils/ export async function cleanupSession(session: Session) { const workspace = session.getWorkspaceInfo(); if (workspace) { await workspaceManager.destroyWorkspace(workspace.id); } } // In tests afterEach(() => cleanupSession(session)); ```