Coding

Write Unit Tests for This Function

✦ ChatGPT 🔥 89 Trend-Score 👁 0 Nutzungen
#testing#unit-tests#quality
Kategorie
Coding
Plattform
ChatGPT
Trend-Score
89/100
Gesamtnutzungen
0
Prompt-Vorlage
Write comprehensive unit tests for the following code. Testing framework: [JEST/PYTEST/JUNIT/MOCHA/etc.]

Function to test:
[PASTE CODE]

Cover: 1) Happy path with representative inputs, 2) Edge cases (empty input, null, boundary values, max values), 3) Error conditions and exception handling, 4) Async behavior if applicable, 5) Side effects and mock dependencies. Use AAA pattern (Arrange-Act-Assert). Aim for 100% branch coverage. For each test, add a brief comment explaining what scenario it tests and why it matters.
Mehr Coding Prompts durchsuchen