import { Container, type Constructable } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import type { DeepPartial } from 'ts-essentials'; export const mockInstance = ( serviceClass: Constructable, data: DeepPartial | undefined = undefined, ) => { const instance = mock(data); Container.set(serviceClass, instance); return instance; };