Add unit and integration tests for API routes and web components #79

Closed
opened 2026-03-20 22:13:28 +00:00 by the-dogfather-cto[bot] · 2 comments
the-dogfather-cto[bot] commented 2026-03-20 22:13:28 +00:00 (Migrated from github.com)

Context

Board directive to start writing tests. Tracked in Paperclip as GRO-76.

Tasks

  1. Install @testing-library/react as dev dependency in apps/web
  2. Write unit tests for existing API route handlers (packages/api/src/routes)
  3. Write unit tests for services (packages/api/src/services)
  4. Write component tests for key web pages (Dashboard, Clients, Appointments, CustomerPortal)
  5. Set up test database fixture in CI
  6. Remove passWithNoTests: true from vitest config once initial tests exist
  7. Add coverage thresholds (aim for 60% initially)

Acceptance Criteria

  • CI runs unit and integration tests on every PR
  • Coverage reported and thresholds enforced
## Context Board directive to start writing tests. Tracked in Paperclip as GRO-76. ## Tasks 1. Install `@testing-library/react` as dev dependency in `apps/web` 2. Write unit tests for existing API route handlers (`packages/api/src/routes`) 3. Write unit tests for services (`packages/api/src/services`) 4. Write component tests for key web pages (Dashboard, Clients, Appointments, CustomerPortal) 5. Set up test database fixture in CI 6. Remove `passWithNoTests: true` from vitest config once initial tests exist 7. Add coverage thresholds (aim for 60% initially) ## Acceptance Criteria - CI runs unit and integration tests on every PR - Coverage reported and thresholds enforced
the-dogfather-cto[bot] commented 2026-03-20 22:26:36 +00:00 (Migrated from github.com)

CTO Technical Guidance

We already have unit testing infrastructure in place (PR #42):

  • API: vitest with pure unit tests in apps/api/src/__tests__/, utility logic in apps/api/src/lib/
  • Web: vitest + jsdom + @testing-library/react, setup in apps/web/src/test/setup.ts, tests in apps/web/src/__tests__/
  • Coverage thresholds: API lib 80%, web 50%

What's still needed (scope for this issue):

  1. API route handler tests — test route logic by mocking the DB layer (Drizzle), not by hitting a real database. We use noUncheckedIndexedAccess: true so guard all array access.
  2. Web component tests — focus on Dashboard, Clients, Appointments pages. Mock global.fetch and wrap renders in act(async () => {...}) per existing patterns.
  3. Do NOT set up a test database fixture in CI yet — pure unit tests with mocked dependencies are the priority.
  4. passWithNoTests: true can be removed once each package has at least one test file.

Tracked in Paperclip as GRO-76 (assigned to Scrubs).

## CTO Technical Guidance We already have unit testing infrastructure in place (PR #42): - **API**: `vitest` with pure unit tests in `apps/api/src/__tests__/`, utility logic in `apps/api/src/lib/` - **Web**: `vitest` + `jsdom` + `@testing-library/react`, setup in `apps/web/src/test/setup.ts`, tests in `apps/web/src/__tests__/` - Coverage thresholds: API lib 80%, web 50% ### What's still needed (scope for this issue): 1. **API route handler tests** — test route logic by mocking the DB layer (Drizzle), not by hitting a real database. We use `noUncheckedIndexedAccess: true` so guard all array access. 2. **Web component tests** — focus on Dashboard, Clients, Appointments pages. Mock `global.fetch` and wrap renders in `act(async () => {...})` per existing patterns. 3. **Do NOT** set up a test database fixture in CI yet — pure unit tests with mocked dependencies are the priority. 4. `passWithNoTests: true` can be removed once each package has at least one test file. Tracked in Paperclip as GRO-76 (assigned to Scrubs).
the-dogfather-cto[bot] commented 2026-03-20 23:21:00 +00:00 (Migrated from github.com)

CTO Update

The tests are written and passing locally (64 API tests + 15 web tests) per @groombook-engineer's report on GRO-76, but the groombook-engineer GitHub App installation has zero repos selected — it cannot push branches or create PRs.

Action needed (org admin): GitHub → Organization Settings → Installed GitHub Apps → groombook-engineer → Configure → Repository access → add groombook/groombook.

Once access is granted, the test PR will be pushed immediately. Branch feat/gro-76-unit-tests is committed locally.

## CTO Update The tests are written and passing locally (64 API tests + 15 web tests) per @groombook-engineer's report on GRO-76, but the `groombook-engineer` GitHub App installation has **zero repos selected** — it cannot push branches or create PRs. **Action needed (org admin):** GitHub → Organization Settings → Installed GitHub Apps → `groombook-engineer` → Configure → Repository access → add `groombook/groombook`. Once access is granted, the test PR will be pushed immediately. Branch `feat/gro-76-unit-tests` is committed locally.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: groombook/app#79