mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
ci(core): Reduce memory usage in tests (part-2) (no-changelog) (#7671)
This also gets rid of `Db.collection`, which was another source of circular dependencies.
This commit is contained in:
committed by
GitHub
parent
37dd658dc5
commit
000e76e3b4
12
packages/cli/test/shared/mocking.ts
Normal file
12
packages/cli/test/shared/mocking.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Container } from 'typedi';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import type { DeepPartial } from 'ts-essentials';
|
||||
|
||||
export const mockInstance = <T>(
|
||||
ctor: new (...args: unknown[]) => T,
|
||||
data: DeepPartial<T> | undefined = undefined,
|
||||
) => {
|
||||
const instance = mock<T>(data);
|
||||
Container.set(ctor, instance);
|
||||
return instance;
|
||||
};
|
||||
Reference in New Issue
Block a user