Tests for the Cases That Actually Break

intermediate
0.0 0 uses Aug 14, 2026 Coding & Development
Works with: ClaudeChatGPTGitHub Copilot
Save
The Prompt
Write [FRAMEWORK] tests for the code below.

Weight the suite toward what breaks in production:
- Boundaries: empty, single element, maximum, off-by-one
- Nulls and missing keys at every level the code touches
- Wrong types where the language allows them through
- Concurrent or repeated calls, if state is involved
- The error paths — assert the message, not just that it threw

One happy-path test is enough.

For each test: a name that states the expectation, arrange/act/assert clearly separated, and no shared mutable state between tests.

After the suite, list what you could NOT test without changing the code, and what the smallest change would be.

CODE:
[CODE]
Variables — replace these:
[CODE]· The code under test [FRAMEWORK]· e.g. PHPUnit, Jest, pytest
Use with these AI models
Claude
Anthropic
Use Now
ChatGPT
OpenAI
Use Now
GitHub Copilot
GitHub
Use Now
Related Prompts
Refactor With the Constraints Stated
Coding & Development · code

A refactor that respects your language version and does not silently change behaviour.

0.0 0
Code Review That Ranks by Severity
Coding & Development · code

A review that separates real bugs from taste, so you know what must be fixed.

0.0 0
Debug From a Stack Trace
Coding & Development · code

Works backwards from the error to the cause and proposes the smallest fix.

0.0 0
Rate this Prompt
0.0 · 0 ratings
Log in to rate
Performance
0
Uses
0
Copies
0
Saves
0
Shares
Prompt Details
CategoryCoding & Development
Typecode
Difficultyintermediate
Tokens360
CreatedAug 14, 2026
UpdatedAug 14, 2026
Share