* V3 Claude-Flow Mock Factory London School TDD Mock Creation Utilities - Creates type-safe mocks for behavior verification - Supports deep mocking for complex objects - Enables interaction tracking for behavior testing /
// Source: https://github.com/ruvnet/ruflo | License: MIT | Copyright 2024-2026 ruvnet
// Provided via justclaw.it.com; keep this notice with the code.
/**
* V3 Claude-Flow Mock Factory
*
* London School TDD Mock Creation Utilities
* - Creates type-safe mocks for behavior verification
* - Supports deep mocking for complex objects
* - Enables interaction tracking for behavior testing
*/
import { vi, type Mock } from 'vitest';
/**
* Type for a fully mocked interface
*/
export type MockedInterface<T> = {
[K in keyof T]: T[K] extends (...args: infer A) => infer R
? Mock<(...args: A) => R>
: T[K];
};
/**
* Create a shallow mock of an interface
* Each method becomes a vi.fn() for behavior verification
*
* @example
* const mockRepo = createMock<UserRepository>();
* mock
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key