feat: adopt TDD — backfill tests, add Vitest, wire CI#13
Conversation
Establishes test-driven development as the mandatory approach across all three layers and backfills coverage for all previously untested code. Backend (Go): - health_usecase: 11 table-driven unit tests covering every message branch - health_handler: 200 and 503 path unit tests - logger middleware: 2xx/4xx/5xx pass-through, query string, gin errors - redis cache: Testcontainers integration tests for all 7 CacheService methods - bootstrap: loadConfig defaults/overrides, validateConfig all-present/missing, jitteredBackoff bounds, probeWithRetry success/retry/timeout/cancel - Makefile itest now covers ./internal/infrastructure/... (adds Redis) Web (Next.js): - Vitest v4 + @testing-library/react v16 + jsdom installed and configured - vitest.config.ts: jsdom env, @vitejs/plugin-react, next/image+link mocks - __tests__/page.test.tsx: 3 smoke tests for the home page - pnpm test / test:watch / test:ui scripts added to package.json Mobile (Android): - GreetingFormatTest.kt replaces ExampleUnitTest (JVM, real greeting logic) - GreetingTest.kt replaces ExampleInstrumentedTest (Compose UI, createComposeRule) Docs + instructions: - CLAUDE.md, AGENTS.md (all layers): TDD mandate, write-tests-first workflow step, "no new feature without tests" hard rule - backend/docs/testing.md: expanded with usecase, handler, Redis, bootstrap patterns - web/docs/testing.md: created (framework, patterns, what to test, quality gate) - mobile/docs/testing.md: updated with TDD mandate, Composable test checklist CI: - backend-ci.yml: fixed action versions, added working-directory, corrected make targets - web-ci.yml: replaces frontend-ci.yml — correct paths, pnpm test, removed Playwright/Firebase stubs that don't exist in this project - mobile-ci.yml: fixed action version
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds three GitHub Actions CI workflows (backend, web, mobile), installs Vitest with React Testing Library for the web layer, adds backend unit tests for usecase/handler/middleware and integration tests for Redis cache and bootstrap, replaces mobile scaffold tests with Greeting-based examples, expands the Makefile ChangesTDD Testing Infrastructure & CI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
pnpm testwired up; 3 smoke tests for the home pageExampleUnitTestandExampleInstrumentedTestdeleted; replaced withGreetingFormatTest(JVM unit) andGreetingTest(Compose UI instrumented)backend-ci.yml,web-ci.yml(replacesfrontend-ci.yml),mobile-ci.ymlall corrected: action versions, working directories, make targets, and stripped Playwright/Firebase stubs that don't belong in this projectbackend/docs/testing.mdexpanded;web/docs/testing.mdcreated;mobile/docs/testing.mdupdatedTest plan
cd backend && go vet ./...— passes cleancd backend && go test ./internal/usecase/... ./internal/transport/... ./internal/bootstrap/... -v— 30/30 unit tests pass (no Docker needed)cd backend && make itest— Postgres + Redis integration tests pass (requires Docker)cd web && pnpm test— 3/3 Vitest tests passcd web && pnpm lint && pnpm build— cleancd mobile && ./gradlew lint && ./gradlew test— lint clean,GreetingFormatTestpassescd mobile && ./gradlew connectedAndroidTest—GreetingTestpasses (requires emulator/device)backend/**,web/**,mobile/**respectivelySummary by CodeRabbit
Tests
Chores