mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix: Remove circular dependencies from cli tests (no-changelog) (#5000)
* fix typescript errors in cli * remove circular dependencies from cli tests
This commit is contained in:
parent
17f13b3b6e
commit
0a416eebea
|
@ -249,6 +249,7 @@ function toTableName(sourceName: CollectionName | MappingName) {
|
||||||
Settings: 'settings',
|
Settings: 'settings',
|
||||||
InstalledPackages: 'installed_packages',
|
InstalledPackages: 'installed_packages',
|
||||||
InstalledNodes: 'installed_nodes',
|
InstalledNodes: 'installed_nodes',
|
||||||
|
WorkflowStatistics: 'workflow_statistics',
|
||||||
}[sourceName];
|
}[sourceName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import { InternalHooksManager } from '../../src';
|
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||||
import { nodeFetchedData, workflowExecutionCompleted } from '../../src/events/WorkflowStatistics';
|
import { nodeFetchedData, workflowExecutionCompleted } from '@/events/WorkflowStatistics';
|
||||||
import { LoggerProxy, WorkflowExecuteMode } from 'n8n-workflow';
|
import { LoggerProxy, WorkflowExecuteMode } from 'n8n-workflow';
|
||||||
import { getLogger } from '@/Logger';
|
import { getLogger } from '@/Logger';
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@ const mockedFirstProductionWorkflowSuccess = jest.fn((...args) => {});
|
||||||
const mockedFirstWorkflowDataLoad = jest.fn((...args) => {});
|
const mockedFirstWorkflowDataLoad = jest.fn((...args) => {});
|
||||||
|
|
||||||
jest.spyOn(InternalHooksManager, 'getInstance').mockImplementation((...args) => {
|
jest.spyOn(InternalHooksManager, 'getInstance').mockImplementation((...args) => {
|
||||||
const actual = jest.requireActual('../../src/InternalHooks');
|
const actual = jest.requireActual('@/InternalHooks');
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
onFirstProductionWorkflowSuccess: mockedFirstProductionWorkflowSuccess,
|
onFirstProductionWorkflowSuccess: mockedFirstProductionWorkflowSuccess,
|
||||||
onFirstWorkflowDataLoad: mockedFirstWorkflowDataLoad,
|
onFirstWorkflowDataLoad: mockedFirstWorkflowDataLoad,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
jest.mock('../../src/Db', () => {
|
jest.mock('@/Db', () => {
|
||||||
return {
|
return {
|
||||||
collections: {
|
collections: {
|
||||||
Workflow: {
|
Workflow: {
|
||||||
|
@ -36,7 +36,7 @@ jest.mock('../../src/Db', () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
jest.mock('../../src/UserManagement/UserManagementHelper', () => {
|
jest.mock('@/UserManagement/UserManagementHelper', () => {
|
||||||
return {
|
return {
|
||||||
getWorkflowOwner: jest.fn((workflowId) => {
|
getWorkflowOwner: jest.fn((workflowId) => {
|
||||||
return { id: FAKE_USER_ID };
|
return { id: FAKE_USER_ID };
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('License', () => {
|
||||||
config.set('license.autoRenewOffset', MOCK_RENEW_OFFSET);
|
config.set('license.autoRenewOffset', MOCK_RENEW_OFFSET);
|
||||||
});
|
});
|
||||||
|
|
||||||
let license;
|
let license: License;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
license = new License();
|
license = new License();
|
||||||
|
@ -102,6 +102,6 @@ describe('License', () => {
|
||||||
jest.fn(license.getMainPlan).mockReset();
|
jest.fn(license.getMainPlan).mockReset();
|
||||||
|
|
||||||
const mainPlan = license.getMainPlan();
|
const mainPlan = license.getMainPlan();
|
||||||
expect(mainPlan.id).toBe(MOCK_MAIN_PLAN_ID);
|
expect(mainPlan?.id).toBe(MOCK_MAIN_PLAN_ID);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { INodeTypeData, INodeTypes, Workflow } from 'n8n-workflow';
|
import { INodeTypeData, INodeTypes, Workflow } from 'n8n-workflow';
|
||||||
|
|
||||||
import { Db } from '../../src';
|
import * as Db from '@/Db';
|
||||||
import * as testDb from '../integration/shared/testDb';
|
import * as testDb from '../integration/shared/testDb';
|
||||||
import { NodeTypes as MockNodeTypes } from './Helpers';
|
import { NodeTypes as MockNodeTypes } from './Helpers';
|
||||||
import { PermissionChecker } from '../../src/UserManagement/PermissionChecker';
|
import { PermissionChecker } from '@/UserManagement/PermissionChecker';
|
||||||
import {
|
import {
|
||||||
randomCredentialPayload as randomCred,
|
randomCredentialPayload as randomCred,
|
||||||
randomPositiveDigit,
|
randomPositiveDigit,
|
||||||
} from '../integration/shared/random';
|
} from '../integration/shared/random';
|
||||||
|
|
||||||
import type { Role } from '../../src/databases/entities/Role';
|
import type { Role } from '@/databases/entities/Role';
|
||||||
import type { SaveCredentialFunction } from '../integration/shared/types';
|
import type { SaveCredentialFunction } from '../integration/shared/types';
|
||||||
|
|
||||||
let testDbName = '';
|
let testDbName = '';
|
||||||
|
|
Loading…
Reference in a new issue