# Write unit tests for my code

Comprehensive unit tests covering happy paths, edge cases, and failures.

- Topic: Software Development
- Framework: RTF
- Level: Standard
- Tags: Coding, Write, Code, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/write-unit-tests-for-my-code

## Prompt

```text
Write unit tests for this code.

**Language and test framework:** [e.g. Python + pytest, TypeScript + Vitest]
**Code under test:**
[PASTE]

Cover:
- Happy paths for each public function/method.
- Edge cases: empty, null, boundary values, large inputs, unusual types.
- Error handling and exceptions.
- Mock external dependencies (network, database, time, randomness).

Return the test file(s), a coverage map (which behaviors each test covers), and any bugs or untestable design you discovered while writing tests.
```

## What to fill in

- e.g. Python + pytest, TypeScript + Vitest
- PASTE

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
