mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-03 10:17:00 +02:00
12 lines
307 B
TypeScript
12 lines
307 B
TypeScript
import { Container, type Constructable } from '@n8n/di';
|
|
import { mock } from 'jest-mock-extended';
|
|
|
|
export const mockInstance = <T>(
|
|
serviceClass: Constructable<T>,
|
|
data?: Parameters<typeof mock<T>>[0],
|
|
) => {
|
|
const instance = mock<T>(data);
|
|
Container.set(serviceClass, instance);
|
|
return instance;
|
|
};
|