PromptFork

Codex test suite generator — unit and edge-case tests from your code

Point Codex at any function and it writes the full test suite: happy path, edge cases, error conditions, and the mocks — covering what you'd write manually but in a fraction of the time.

Open in Studio
Prompt
Paste into the Codex CLI with the code you want tested:

'Write a complete test suite for the following [LANGUAGE] code using [TEST FRAMEWORK, e.g. Jest / Pytest / Vitest / Go testing].

[PASTE YOUR CODE]

Cover every case in this order:

1. HAPPY PATH TESTS:
The standard scenarios where everything works as expected. For each: what input, what expected output, why this case matters.

2. EDGE CASES:
- Empty inputs, null/undefined/None values
- Boundary values (zero, negative numbers, empty arrays, max length strings)
- Unusual but valid inputs that could trip up naive implementations

3. ERROR / EXCEPTION CASES:
Every code path that throws, rejects, or returns an error state. Test that the right error is thrown with the right message, not just that any error occurs.

4. MOCKS AND STUBS:
For any external dependencies (database calls, HTTP requests, file system, timers), provide the mock setup. Use [jest.fn() / unittest.mock / vi.fn()] — do not hit real external services in tests.

FORMAT RULES:
- One describe block per logical group of behavior
- Test names as plain English sentences: describe what the test verifies, not what the function is called
- No skipped (xit / @pytest.mark.skip) tests — every test must pass
- No placeholder assertions (expect(true).toBe(true)) — every assertion must be meaningful
- Comments only where the test setup is non-obvious

The output must run with: [npm test / pytest / go test ./...] and pass without modification.'

Tip: paste your existing test file alongside the source and say 'follow the existing test patterns and add coverage for these gaps:' — Codex will match your test style rather than introducing a different describe/it structure.
Source
promptfork seed
License
CC-BY-4.0
Published
6/22/2026

More prompts you might like

Editor’s pickCoding & DevelopmentSeed

Codex API scaffolder — REST endpoint from a plain-English spec

Describe your endpoint in plain English and Codex builds the full implementation: route handler, request validation, error responses, and a usage example — no boilerplate writing required.

New

Codex code explainer and refactor — read, diagnose, rewrite clean

Paste any function and Codex returns a plain-English explanation, a list of specific problems, and a refactored version with notes on every change — so you understand what changed and why.

New

Codex CLI script builder — describe the automation, get the script

Tell Codex what you want to automate in plain English and it writes the complete script — with argument parsing, error handling, progress output, and dry-run mode — ready to run without cleanup.

New

Codex bug hunter — root cause, not just a patch

Paste the buggy code and the error, and Codex diagnoses the root cause, explains why the obvious fix won't work, and gives you the correct fix with a regression test so the bug can never come back silently.

New

Next.js 15 App Router page with streaming, caching, and server data

Scaffold a production App Router page: Server Component data fetching, Suspense streaming for instant TTFB, correct cache strategy (fetch cache vs unstable_cache vs revalidatePath), loading/error boundaries, and generateMetadata — with the non-obvious patterns most tutorials skip.

New

Tailwind analytics dashboard with animated stat cards, dark mode, and skeleton loading

Production-grade dashboard layout: KPI cards with counting animations and trend sparklines, a chart area, activity table — all with dark mode, skeleton loading states, and responsive breakpoints defined to the pixel.

New