webmaxru/bpm-counter/azure-functions-test-mocking
Claude Code and agent skill by webmaxru/bpm-counter
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Patterns for unit testing Azure Functions with Jest, including module isolation for side-effect-heavy handlers
Install
npx vskill@latest install webmaxru/bpm-counter/azure-functions-test-mockingSKILL.md
Context
Azure Functions handlers often have module-scope side effects (App Insights setup, database client init). Standard jest.mock() doesn't reset between tests, causing cross-test pollution. This skill covers the isolation pattern.
Patterns
1. Module isolation via jest.resetModules() + jest.isolateModules()
- Call
loadHandler()in each test for fresh module scope - Use
jest.doMock()(notjest.mock()) insideisolateModules - Add
{ virtual: true }for packages not yet installed jest.resetModules()beforeisolateModulesis defensive best practice
2. Mock Azure Functions context
3. Falsy-valid edge cases
Always test { bpm: 0, isCorrect: false } to catch truthy-based validation bugs.
4. Client principal header testing
5. Comprehensive early-return validation test
Anti-Patterns
- Top-level `jest.mock()` for module-scope side effects — leads to cached mocks across tests
- Asserting `context.done()` was called — modern async functions should
return, notcontext.done() - Defaulting `body = {}` in request helpers — hides the "missing body" edge case
- Skipping `{ virtual: true }` — tests crash if mocked package isn't installed
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.squad/skills/azure-functions-test-mocking/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/webmaxru/bpm-counter/azure-functions-test-mocking)