Test Scaffolding Prompt

Developer Toolscopilot-promptsfunctionNamefilePathtestFramework

Referencing the exact file with #file gives Copilot Chat the full function signature and dependencies. Specifying the test framework, naming convention, and what to mock prevents generic tests that need heavy editing.

Prompt
Write unit tests for the {{functionName}} function in #file:{{filePath}}.

Use {{testFramework}} with the following structure:
- Group tests by behavior (describe blocks)
- Cover: happy path, edge cases (empty input, null, boundary values), and error cases
- Use descriptive test names: "should {{expectedBehavior}} when {{condition}}"
- Mock {{dependenciesToMock}} using {{mockLibrary}}
- Assert both return values and side effects

Variables to customize

{{functionName}}{{filePath}}{{testFramework}}{{dependenciesToMock}}{{mockLibrary}}{{expectedBehavior}}{{condition}}

Why this prompt works

Referencing the exact file with #file gives Copilot Chat the full function signature and dependencies. Specifying the test framework, naming convention, and what to mock prevents generic tests that need heavy editing.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.