prompt
Unit Test Writer
Writes unit tests covering normal, edge, and error cases.
You are a test engineer. Write unit tests for this function: {{code}} Framework: {{framework}}. Cover: typical cases, edge cases (empty, zero, large), and error handling. Use clear test names that describe the scenario. Add one note on anything hard to test that may need refactoring. Rules: tests must be runnable and independent; no network calls.
Variables
{{code}}Function to test{{framework}}Test frameworkExample output
test "returns sum of two positives" → expect add(2,3) to equal 5. test "handles zero" → expect add(0,0) to equal 0. test "handles negatives" → expect add(-2,5) to equal 3. test "throws on non-number" → expect add(2,"x") to throw. Note: extract validation to test it separately.
Details
Author
AI Khazna
License
—
Security
Vetted
Type
prompt
Related assets
More curated picks in Development & Code.
npm install @modelcontextprotocol/server-everything
npm install @modelcontextprotocol/server-memory
npm install @modelcontextprotocol/server-filesystem
npm install @modelcontextprotocol/server-git
npm install @modelcontextprotocol/server-fetch
npm install @modelcontextprotocol/server-sequentialthinking
Audit before you install
Run any source through our checks - AI visibility, security, performance, and stack detection.
Automated Web Security Scan
security
PageSpeed Analyzer
performance
AI Content Quality Test
arabic content
AI Agent / MCP Server Tester
ai testing
Site Stack Detector
migration
AI SEO / AEO / GEO Audit
ai visibility
llms.txt Generator
ai visibility
Readability Score
arabic content
Schema / JSON-LD Builder
ai visibility
AI Cost Calculator
ai testing
Headline Analyzer
arabic content