http-mocking
Installation
SKILL.md
Nock HTTP Mocking Patterns
Critical Rule: ONLY nock for HTTP Mocking
This is a CRITICAL rule that MUST be enforced:
✅ ONLY nock is allowed for HTTP mocking
❌ NEVER use jest.mock, sinon, or fetch-mock
See failure-conditions skill Rule 4 for enforcement.
Core Principles
- Mock at HTTP level - Mock the network request, not internal methods
- Match requests accurately - Include method, path, headers, query params
- Return realistic responses - Use response formats matching real API
- Clean up after tests - Use
afterEach(() => nock.cleanAll()) - Verify mocks called - Assert
expect(nock.isDone()).toBe(true)