Add integration test coverage for core auth, paywall, CRUD, and export flows #46

Closed
opened 2026-07-31 07:21:25 +00:00 by Mark · 0 comments
Owner

Goal

Bring coverage to the core user-facing flows of nodedesk so a regression in any of them breaks CI. This satisfies EPIC B Phase 5 exit criteria (nodedesk#41: "Core auth/paywall/CRUD/export flows are covered").

Repo layout (verified on origin/main)

  • E2E tests: Playwright specs in tests/*.spec.ts (17 specs exist; pnpm test = npx playwright test).
  • Unit tests: Vitest, co-located in src/**/*.test.ts (e.g. src/services/storage.test.ts, src/middleware/attachmentAuthz.test.ts, src/app/api/attachments/attachments.test.ts); pnpm test:unit = vitest run. vitest.config.ts excludes tests/** from vitest.
  • Existing e2e specs: auth (auth.spec.ts, magic-link.spec.ts, dev-login.spec.ts, protected-routes.spec.ts), paywall (paywall.spec.ts), CRUD (client-create.spec.ts, client-edit.spec.ts, notes.spec.ts, worklog-timer.spec.ts, search.spec.ts, account-delete.spec.ts, attachments.spec.ts, settings.spec.ts, dashboard.spec.ts).
  • Export (CSV/PDF/JSON): NO spec exists — this is the known gap.

Work

For each of the four flow families, check whether an integration test exists; if not (or if only a happy path exists), add one that exercises the real handler/route (not a unit-mocked internal helper) covering the happy path plus one negative case (unauthorized, invalid input, paywall-denied). Flow families:

  1. auth — signup/login/logout/session refresh.
  2. paywall — entitlement check, plan upgrade/downgrade, webhook handling.
  3. CRUD — create/read/update/delete for the primary domain entities (clients, notes, worklog, attachments).
  4. export — CSV/PDF/JSON export endpoints (happy path + negative case required; no existing coverage).

Acceptance criteria

  • One passing test file per flow family (auth, paywall, CRUD, export) added under the existing test tree.
  • Each test calls the real handler/route so regressions in wiring are caught.
  • pnpm test, pnpm test:unit, and CI remain green with the new tests.
  • List each new test file path and the flow it covers in the PR description.

Verification

  • pnpm test (Playwright e2e)
  • pnpm test:unit (Vitest)
  • pnpm lint / typecheck if touched

Source: kanban card t_4fe1bb6d (tasker-worker). Part of EPIC B (nodedesk#38/#41), decomposed from nodedesk#2.

## Goal Bring coverage to the core user-facing flows of nodedesk so a regression in any of them breaks CI. This satisfies EPIC B Phase 5 exit criteria (nodedesk#41: "Core auth/paywall/CRUD/export flows are covered"). ## Repo layout (verified on origin/main) - E2E tests: Playwright specs in `tests/*.spec.ts` (17 specs exist; `pnpm test` = `npx playwright test`). - Unit tests: Vitest, co-located in `src/**/*.test.ts` (e.g. `src/services/storage.test.ts`, `src/middleware/attachmentAuthz.test.ts`, `src/app/api/attachments/attachments.test.ts`); `pnpm test:unit` = `vitest run`. `vitest.config.ts` excludes `tests/**` from vitest. - Existing e2e specs: auth (auth.spec.ts, magic-link.spec.ts, dev-login.spec.ts, protected-routes.spec.ts), paywall (paywall.spec.ts), CRUD (client-create.spec.ts, client-edit.spec.ts, notes.spec.ts, worklog-timer.spec.ts, search.spec.ts, account-delete.spec.ts, attachments.spec.ts, settings.spec.ts, dashboard.spec.ts). - Export (CSV/PDF/JSON): NO spec exists — this is the known gap. ## Work For each of the four flow families, check whether an integration test exists; if not (or if only a happy path exists), add one that exercises the real handler/route (not a unit-mocked internal helper) covering the happy path plus one negative case (unauthorized, invalid input, paywall-denied). Flow families: 1. **auth** — signup/login/logout/session refresh. 2. **paywall** — entitlement check, plan upgrade/downgrade, webhook handling. 3. **CRUD** — create/read/update/delete for the primary domain entities (clients, notes, worklog, attachments). 4. **export** — CSV/PDF/JSON export endpoints (happy path + negative case required; no existing coverage). ## Acceptance criteria - One passing test file per flow family (auth, paywall, CRUD, export) added under the existing test tree. - Each test calls the real handler/route so regressions in wiring are caught. - `pnpm test`, `pnpm test:unit`, and CI remain green with the new tests. - List each new test file path and the flow it covers in the PR description. ## Verification - `pnpm test` (Playwright e2e) - `pnpm test:unit` (Vitest) - `pnpm lint` / typecheck if touched --- _Source: kanban card t_4fe1bb6d (tasker-worker). Part of EPIC B (nodedesk#38/#41), decomposed from nodedesk#2._
Mark 2026-08-05 03:03:29 +00:00
Sign in to join this conversation.
No description provided.