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:
कारतोफ्फेलस्क्रिप्ट™ 2022-12-22 10:14:15 +01:00 committed by GitHub
parent 17f13b3b6e
commit 0a416eebea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View file

@ -249,6 +249,7 @@ function toTableName(sourceName: CollectionName | MappingName) {
Settings: 'settings',
InstalledPackages: 'installed_packages',
InstalledNodes: 'installed_nodes',
WorkflowStatistics: 'workflow_statistics',
}[sourceName];
}

View file

@ -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 };

View file

@ -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);
});
});

View file

@ -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 = '';