Skip to content

Add comprehensive test suite for v5 (unit, integration, UI, E2E)#26

Merged
philosophercode merged 1 commit into
mainfrom
philosophercode/v5-test-suite
Jun 2, 2026
Merged

Add comprehensive test suite for v5 (unit, integration, UI, E2E)#26
philosophercode merged 1 commit into
mainfrom
philosophercode/v5-test-suite

Conversation

@philosophercode

Copy link
Copy Markdown
Owner

Summary

Establishes a comprehensive, fully-mocked, CI-friendly test suite for the v5 app — there were previously zero tests and no test tooling. Four layers: unit, integration, component/UI, and end-to-end. No layer makes live calls to Notion, Anthropic, or Redis, so the whole thing runs offline and deterministically.

Totals: 224 Vitest tests + 15 Playwright E2E tests. Lint and tsc clean.

Tooling & harness

  • Vitest + React Testing Library + user-event + jest-dom + MSW for unit/integration/component.
  • Playwright for E2E (runs the app with NOTION_* unset so it serves the built-in mock catalog; /api/chat is intercepted at the network layer).
  • Shared harness under v5/test/: MSW handlers, Notion + catalog fixtures, next/cache mock, server-only alias, and a custom i18n render helper. Documented in v5/test/README.md.
  • 5 new scripts: test, test:watch, test:coverage, test:e2e, test:e2e:ui.

Coverage

Layer What
Unit (src/lib, src/i18n) catalog, notion (parsers, pagination, 429 retry, write payloads), rate-limit, site-config, i18n/config
Integration (API routes) /api/chat (streamText-capture pattern), /api/mcp (real JSON-RPC), /api/upload-notion, /api/admin/revalidate
Component (RTL) ToolCard, GalleryShell, UnitsList, DetailShell, ChatFab, LanguageSelector, ThemeToggle, GlobalChrome, PrimaryNav
E2E (Playwright) gallery, tool detail, search, chat (intercepted stream), theme/i18n, navigation

Notes

  • Tests assert real component behavior — where the app diverged from initial assumptions (e.g. ToolCard's lean markup, DetailShell rendering its own units table with no markdown, not-found returning 200 under next dev), the tests follow the source and the divergences are documented inline.
  • Fixed a harness-wide window.localStorage breakage (Node's --localstorage-file clobbers jsdom's Storage) centrally in vitest.setup.ts.
  • No CI workflow or coverage gate is included by design (scope was tests + runbook only); a coverage reporter is wired via test:coverage.
  • Design/dispatch plan: docs/superpowers/specs/2026-05-29-v5-test-suite-design.md. Runbook: v5/TESTING.md.

Test plan

cd v5
npm test                          # 224 unit + integration + component
npx playwright install chromium   # once
npm run test:e2e                  # 15 E2E
npm run lint && npx tsc --noEmit  # both clean

🤖 Generated with Claude Code

Establish a fully-mocked, CI-friendly test suite for the v5 app:

- Tooling: Vitest + React Testing Library + user-event + jest-dom + MSW
  for unit/integration/component tests; Playwright for E2E. Shared harness
  under v5/test/ (MSW handlers, Notion/catalog fixtures, next/cache mock,
  server-only alias, i18n render helper) plus 5 npm scripts.
- Unit (src/lib, src/i18n): catalog, notion, rate-limit, site-config, i18n
  config — pure logic and the Notion data layer (parsers, pagination, retry,
  write payloads), all mocked via MSW.
- Integration (API routes): /api/chat (streamText-capture pattern),
  /api/mcp (real JSON-RPC), /api/upload-notion, /api/admin/revalidate.
- Component (RTL): ToolCard, GalleryShell, UnitsList, DetailShell, ChatFab,
  LanguageSelector, ThemeToggle, GlobalChrome, PrimaryNav.
- E2E (Playwright): gallery, tool detail, search, chat (intercepted stream),
  theme/i18n, navigation — app runs against the built-in mock catalog with
  NOTION_* unset, no live external calls anywhere.
- Docs: design/dispatch plan in docs/superpowers/specs and a v5/TESTING.md
  runbook.

224 Vitest tests + 15 Playwright tests; lint and tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 04:17
@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
makerlab-tools Ready Ready Preview, Comment May 30, 2026 4:19am
makerlab-tools-v5 Ready Ready Preview, Comment May 30, 2026 4:19am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93fe6beee7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread v5/package-lock.json
Comment on lines 24 to +41
"devDependencies": {
"@playwright/test": "^1.60.0",
"@tailwindcss/postcss": "^4",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@vitejs/plugin-react": "^6.0.2",
"eslint": "^9",
"eslint-config-next": "16.1.6",
"jsdom": "^29.1.1",
"msw": "^2.14.6",
"tailwindcss": "^4",
"typescript": "^5"
"typescript": "^5",
"vitest": "^4.1.7"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Regenerate the lockfile so clean installs work

After this lockfile update, a fresh install is blocked before any tests can run: I checked v5 with npm ci, and npm exits with package.json and package-lock.json ... are in sync plus missing entries such as @emnapi/runtime, @emnapi/core, and @swc/helpers. This means CI or any new checkout that uses the committed lockfile cannot install the dependencies added for the test suite until the lockfile is regenerated from a complete install.

Useful? React with 👍 / 👎.

Comment thread v5/package.json
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the Vitest V8 coverage provider dependency

The new test:coverage script selects coverage.provider: "v8", but @vitest/coverage-v8 is not installed as a dev dependency; in the lockfile it only appears in Vitest's optional peer metadata, and there is no node_modules/@vitest/coverage-v8 package entry. On a fresh install after the lockfile is fixed, npm run test:coverage will fail or prompt for the missing provider instead of producing coverage, which breaks the documented coverage workflow.

Useful? React with 👍 / 👎.

@philosophercode philosophercode merged commit 166a1a1 into main Jun 2, 2026
3 of 4 checks passed
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.

2 participants