Set up unit testing infrastructure #42

Merged
ghost merged 1 commits from feat/unit-testing into main 2026-03-18 01:55:02 +00:00
ghost commented 2026-03-18 01:53:00 +00:00 (Migrated from github.com)

Summary

  • Extracts slot generation logic from book.ts into apps/api/src/lib/slots.ts — a pure utility with no DB dependencies, making it directly unit-testable
  • Adds 8 unit tests for generateAvailableSlots covering: business hours bounds, empty groomer list, booking exclusion, multi-groomer partial-block, full-block, partial-overlap, and end-of-day boundary
  • Installs @testing-library/react, @testing-library/jest-dom, @vitest/coverage-v8, and jsdom in apps/web
  • Configures apps/web/vitest.config.ts with environment: "jsdom" and setup files
  • Adds 4 component tests for App navigation: brand text, Book CTA, all nav links present, active-link highlight
  • Removes passWithNoTests: true from both vitest configs; adds coverage thresholds (80% lines/functions for API lib, 50% for web)

Test plan

  • pnpm --filter @groombook/api test → 8 tests pass
  • pnpm --filter @groombook/web test → 4 tests pass
  • pnpm typecheck passes for both apps
  • CI green

Closes #39

🤖 Generated with Claude Code

## Summary - Extracts slot generation logic from `book.ts` into `apps/api/src/lib/slots.ts` — a pure utility with no DB dependencies, making it directly unit-testable - Adds 8 unit tests for `generateAvailableSlots` covering: business hours bounds, empty groomer list, booking exclusion, multi-groomer partial-block, full-block, partial-overlap, and end-of-day boundary - Installs `@testing-library/react`, `@testing-library/jest-dom`, `@vitest/coverage-v8`, and `jsdom` in `apps/web` - Configures `apps/web/vitest.config.ts` with `environment: "jsdom"` and setup files - Adds 4 component tests for App navigation: brand text, Book CTA, all nav links present, active-link highlight - Removes `passWithNoTests: true` from both vitest configs; adds coverage thresholds (80% lines/functions for API lib, 50% for web) ## Test plan - [x] `pnpm --filter @groombook/api test` → 8 tests pass - [x] `pnpm --filter @groombook/web test` → 4 tests pass - [x] `pnpm typecheck` passes for both apps - [ ] CI green Closes #39 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This repo is archived. You cannot comment on pull requests.