Skip to content

Testing And Verification

Last refreshed: 2026-05-18

Commands

  • pnpm lint: Biome checks.
  • pnpm typecheck: TypeScript strict check.
  • pnpm test:int: Vitest integration/unit suite configured by vitest.config.mts.
  • pnpm test:e2e: Playwright e2e suite.
  • pnpm test: integration plus e2e.

Test Layout

  • tests/unit: contract, billing, metering, source adapter, web normalization, and Mastra web tool tests.
  • tests/integration: Presentation Video server action integration tests with fake Payload/runtime harness.
  • tests/e2e: route-level Presentation Video flow tests.
  • tests/fixtures: fixture data such as Zoho webhook examples.

Presentation Integration Harness

Read tests/integration/README.md before adding presentation action tests.

Shared helpers:

  • helpers/presentation-fixtures.ts
  • helpers/fake-payload.ts
  • helpers/mock-runtime.ts
  • helpers/presentation-harness.ts

Tests should assert both returned action results and persisted fake DB state.

E2E Setup

pnpm test:e2e starts its own dev server. It uses:

  • E2E_BYPASS_AUTH=1
  • NEXT_PUBLIC_E2E_PRESENTATION_MOCK=1

Use e2e tests for route-level workflow behavior such as setup validation, scene generation, preview controls, stale-state blocking, and per-scene assistants.

When To Run What

  • Docs-only changes: inspect generated docs and run no code checks unless links/scripts are touched.
  • Server action changes: pnpm lint, pnpm typecheck, and pnpm test:int.
  • Presentation flow changes: add pnpm test:e2e.
  • Payload schema changes: pnpm generate:types, optionally pnpm generate:importmap, then typecheck/tests.
  • Billing changes: run tests/unit/zoho-billing.test.ts and tests/unit/ai-coin-metering.test.ts through pnpm test:int.
  • RAG/source changes: run RAG/source unit tests and relevant presentation integration tests.
flowchart TD
  change["🛠️ Change type"] --> docsOnly{"Docs only?"}
  docsOnly -->|yes| inspect["👁️ Inspect docs output"]
  docsOnly -->|no| codeArea{"Touched area"}
  codeArea --> actions["Server actions: lint, typecheck, test:int"]
  codeArea --> presentation["Presentation flow: add test:e2e"]
  codeArea --> payload["Payload schema: generate types/import map"]
  codeArea --> billing["Billing: targeted unit tests"]
  codeArea --> rag["RAG/source: RAG tests and integration coverage"]

Docs Parity

Every behavior-changing implementation should update:

  • docs/core for durable system behavior.
  • docs/state for paths, commands, maps, gaps, or operational state.
  • docs/changes/<change> for change-specific reasoning when using the large-change workflow.