Skip to content

test: add unit tests, ESLint, Prettier, Husky, and CI pipeline#8

Merged
audemed44 merged 1 commit into
mainfrom
feat/testing-linting-ci
Mar 1, 2026
Merged

test: add unit tests, ESLint, Prettier, Husky, and CI pipeline#8
audemed44 merged 1 commit into
mainfrom
feat/testing-linting-ci

Conversation

@audemed44

Copy link
Copy Markdown
Owner

Summary

  • Server refactoring: Routes converted to factory pattern (createApp(db), createXxxRouter(db)) to enable in-memory SQLite testing without touching the production DB
  • 74 server tests via Vitest + supertest — 99% line coverage across all routes, DB mappers, recurring processor, and logger
  • 119 client tests via Vitest + Testing Library — 96% line coverage across API client, finance utilities, CSV import/export, hooks, and mobile detection
  • ESLint (flat config with typescript-eslint + react-hooks + react-refresh) and Prettier for consistent code style
  • Husky pre-commit hook: runs lint-staged (auto-fix ESLint + Prettier on staged files) then full test suite before every commit
  • commitlint enforces conventional commit format on every commit message
  • CI pipeline updated with 3 parallel jobs: lint, test (with coverage artifact upload), build

Coverage thresholds (both workspaces)

Metric Threshold Server actual Client actual
Lines 90% 99.1% 96.4%
Statements 80% 98.6% 95.6%
Branches 80% 88.6% 85.1%
Functions 80% 97.0% 90.6%

Test plan

  • npm run lint — 0 errors
  • npm run test:coverage — all 193 tests pass, all thresholds met
  • npm run build — server + client build successfully
  • Commitlint rejects bad message (bad commit message → fails)
  • Commitlint accepts valid message (feat(auth): add login → passes)
  • Pre-commit hook fires lint-staged + tests on git commit

🤖 Generated with Claude Code

@audemed44 audemed44 force-pushed the feat/testing-linting-ci branch from 660afa1 to 89d4190 Compare March 1, 2026 03:28
- Refactor server routes to factory pattern (createApp/createXxxRouter)
  for testability with in-memory SQLite
- Add 74 server tests (99% line coverage) via Vitest + supertest
- Add 119 client tests (96% line coverage) via Vitest + Testing Library
- Configure ESLint flat config and Prettier for consistent code style
- Add Husky pre-commit hooks with lint-staged and commitlint validation
- Update CI pipeline with parallel lint, test, and build jobs
@audemed44 audemed44 force-pushed the feat/testing-linting-ci branch from 89d4190 to 6cd35bd Compare March 1, 2026 03:30
@audemed44 audemed44 merged commit 42f9016 into main Mar 1, 2026
3 checks passed
@audemed44 audemed44 deleted the feat/testing-linting-ci branch March 1, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant