mirror of
https://github.com/n8n-io/n8n.git
synced 2026-07-28 19:45:09 +02:00
33 lines
738 B
TypeScript
33 lines
738 B
TypeScript
/**
|
|
* Global test setup file.
|
|
*
|
|
* Provides default mocks for DI infrastructure so test files that call
|
|
* `Container.get(AiConfig)` at module level don't need to set up their own
|
|
* DI mocks unless they need custom behaviour.
|
|
*/
|
|
|
|
vi.mock('@n8n/di', () => ({
|
|
Container: {
|
|
get: vi.fn().mockImplementation(() => ({
|
|
openAiDefaultHeaders: {},
|
|
})),
|
|
getOrDefault: vi.fn().mockReturnValue(undefined),
|
|
set: vi.fn(),
|
|
has: vi.fn().mockReturnValue(false),
|
|
},
|
|
Service: () => () => {},
|
|
}));
|
|
|
|
vi.mock('@n8n/config', async () => {
|
|
const actual = await vi.importActual<typeof import('@n8n/config')>('@n8n/config');
|
|
|
|
class AiConfig {
|
|
openAiDefaultHeaders: Record<string, string> = {};
|
|
}
|
|
|
|
return {
|
|
...actual,
|
|
AiConfig,
|
|
};
|
|
});
|