# Implement TDD practices in PalaceApp **Linear:** MAN-68 — https://linear.app/manglasabang/issue/MAN-68/implement-tdd-practices-in-palaceapp **Status:** Next Up **Project:** palacering ## Description Adopt test-driven development across PalaceApp. Best practices to follow: 1. **Red-Green-Refactor per feature** — Write a failing test first, write minimum code to pass, then clean up. 2. **Test at the right layer** — Unit tests (Jest/pytest) for business logic, integration tests for API contracts, E2E (Playwright/Detox) sparingly for critical flows. 3. **Colocate tests with source** — `foo.ts` → `foo.test.ts` next to it. `foo.py` → `test_foo.py`. 4. **Test behavior, not implementation** — Tests describe *what* code does, not *how*. 5. **Enforce in CI** — Run `turbo test` on every PR, add coverage thresholds (start at 60%), tighten pre-commit hook. 6. **Backfill strategically** — Add tests whenever touching existing files. 7. **Keep tests fast** — Mock external deps, keep `turbo test` under 30s.