Overview

Good tests prove behavior, not implementation. Ask Blink to follow your existing libraries and conventions, cover edge cases, and keep tests fast and deterministic.

Before You Start

  • State your testing libraries and folders (e.g., Jest + Testing Library, Playwright)
  • Link an example test that represents your style
  • Define what must be covered for acceptance

Workflow

  1. Identify critical paths and edge cases
  2. Ask for tests that mirror your patterns
  3. Run locally and in CI; iterate on flaky tests
  4. Add coverage gates only after stable tests

Prompt Templates

Context:
- Stack: Next.js + React, Jest + Testing Library, Playwright for e2e
- Target: checkout flow (cart -> payment -> confirmation)
- Acceptance: unit tests for totals, integration test for form, e2e happy path

Task: Generate tests matching our patterns (see tests/cart.test.ts for style). Add data builders, avoid real network calls, and ensure idempotent runs in CI.
We’ve seen flakiness in our e2e.
- Suggest fixes (timeouts, deterministic IDs, network stubs)
- Show Playwright config tweaks
- Add retry strategy that won’t hide real failures

Anti‑Patterns and Recovery

  • Over-mocking: prefer integration tests at module boundaries
  • Slow tests by default: parallelize and stub external IO
  • Testing implementation details: assert user-visible behavior
  • Tests that compile and run in your environment
  • Examples that follow your project’s test style
  • Small PRs that incrementally raise confidence