unit-test-implementation
Installation
SKILL.md
Unit Test Implementation Guide
Mocking Dependencies
Use jest-mock-extended for External Dependencies
Use jest-mock-extended for dependencies that are external to the unit under test:
import { mock, mockDeep, mockFn, type MockProxy } from "jest-mock-extended";
let httpClient: MockProxy<HttpClient>;
let database: MockProxy<Database>;
beforeEach(() => {
httpClient = mock<HttpClient>();
database = mockDeep<Database>(); // Use mockDeep when mocking nested properties
});