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',
|
||||
InstalledPackages: 'installed_packages',
|
||||
InstalledNodes: 'installed_nodes',
|
||||
WorkflowStatistics: 'workflow_statistics',
|
||||
}[sourceName];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import config from '@/config';
|
||||
import { InternalHooksManager } from '../../src';
|
||||
import { nodeFetchedData, workflowExecutionCompleted } from '../../src/events/WorkflowStatistics';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { nodeFetchedData, workflowExecutionCompleted } from '@/events/WorkflowStatistics';
|
||||
import { LoggerProxy, WorkflowExecuteMode } from 'n8n-workflow';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
|
@ -10,14 +10,14 @@ const mockedFirstProductionWorkflowSuccess = jest.fn((...args) => {});
|
|||
const mockedFirstWorkflowDataLoad = jest.fn((...args) => {});
|
||||
|
||||
jest.spyOn(InternalHooksManager, 'getInstance').mockImplementation((...args) => {
|
||||
const actual = jest.requireActual('../../src/InternalHooks');
|
||||
const actual = jest.requireActual('@/InternalHooks');
|
||||
return {
|
||||
...actual,
|
||||
onFirstProductionWorkflowSuccess: mockedFirstProductionWorkflowSuccess,
|
||||
onFirstWorkflowDataLoad: mockedFirstWorkflowDataLoad,
|
||||
};
|
||||
});
|
||||
jest.mock('../../src/Db', () => {
|
||||
jest.mock('@/Db', () => {
|
||||
return {
|
||||
collections: {
|
||||
Workflow: {
|
||||
|
@ -36,7 +36,7 @@ jest.mock('../../src/Db', () => {
|
|||
},
|
||||
};
|
||||
});
|
||||
jest.mock('../../src/UserManagement/UserManagementHelper', () => {
|
||||
jest.mock('@/UserManagement/UserManagementHelper', () => {
|
||||
return {
|
||||
getWorkflowOwner: jest.fn((workflowId) => {
|
||||
return { id: FAKE_USER_ID };
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('License', () => {
|
|||
config.set('license.autoRenewOffset', MOCK_RENEW_OFFSET);
|
||||
});
|
||||
|
||||
let license;
|
||||
let license: License;
|
||||
|
||||
beforeEach(async () => {
|
||||
license = new License();
|
||||
|
@ -102,6 +102,6 @@ describe('License', () => {
|
|||
jest.fn(license.getMainPlan).mockReset();
|
||||
|
||||
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 { INodeTypeData, INodeTypes, Workflow } from 'n8n-workflow';
|
||||
|
||||
import { Db } from '../../src';
|
||||
import * as Db from '@/Db';
|
||||
import * as testDb from '../integration/shared/testDb';
|
||||
import { NodeTypes as MockNodeTypes } from './Helpers';
|
||||
import { PermissionChecker } from '../../src/UserManagement/PermissionChecker';
|
||||
import { PermissionChecker } from '@/UserManagement/PermissionChecker';
|
||||
import {
|
||||
randomCredentialPayload as randomCred,
|
||||
randomPositiveDigit,
|
||||
} 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';
|
||||
|
||||
let testDbName = '';
|
||||
|
|
Loading…
Reference in a new issue