refactor(core): Move integration test utils for insights (#16693)

This commit is contained in:
Iván Ovejero
2025-06-25 17:32:54 +02:00
committed by GitHub
parent a6ded1fc80
commit 7c33292483
231 changed files with 684 additions and 651 deletions

View File

@@ -1,20 +1,20 @@
import type { CredentialPayload } from '@n8n/backend-test-utils';
import { createTeamProject } from '@n8n/backend-test-utils';
import { randomName } from '@n8n/backend-test-utils';
import { testDb } from '@n8n/backend-test-utils';
import type { User } from '@n8n/db';
import { CredentialsRepository } from '@n8n/db';
import { SharedCredentialsRepository } from '@n8n/db';
import { Container } from '@n8n/di';
import { randomString } from 'n8n-workflow';
import { createTeamProject } from '@test-integration/db/projects';
import {
affixRoleToSaveCredential,
createCredentials,
getCredentialSharings,
} from '../shared/db/credentials';
import { createMemberWithApiKey, createOwnerWithApiKey } from '../shared/db/users';
import { randomName } from '../shared/random';
import * as testDb from '../shared/test-db';
import type { CredentialPayload, SaveCredentialFunction } from '../shared/types';
import type { SaveCredentialFunction } from '../shared/types';
import type { SuperAgentTest } from '../shared/types';
import * as utils from '../shared/utils/';

View File

@@ -1,3 +1,8 @@
import type { CredentialPayload } from '@n8n/backend-test-utils';
import { createTeamProject, getProjectByNameOrFail } from '@n8n/backend-test-utils';
import { createWorkflow } from '@n8n/backend-test-utils';
import { randomName } from '@n8n/backend-test-utils';
import { testDb } from '@n8n/backend-test-utils';
import type { TagEntity, Variables } from '@n8n/db';
import { ApiKeyRepository } from '@n8n/db';
import { CredentialsRepository } from '@n8n/db';
@@ -12,7 +17,6 @@ import validator from 'validator';
import { affixRoleToSaveCredential, createCredentials } from '@test-integration/db/credentials';
import { createErrorExecution, createSuccessfulExecution } from '@test-integration/db/executions';
import { createTeamProject, getProjectByNameOrFail } from '@test-integration/db/projects';
import { createTag } from '@test-integration/db/tags';
import {
createAdminWithApiKey,
@@ -23,12 +27,9 @@ import {
getUserById,
} from '@test-integration/db/users';
import { createVariable, getVariableByIdOrFail } from '@test-integration/db/variables';
import { createWorkflow } from '@test-integration/db/workflows';
import { randomName } from '@test-integration/random';
import type { CredentialPayload, SaveCredentialFunction } from '@test-integration/types';
import type { SaveCredentialFunction } from '@test-integration/types';
import { setupTestServer } from '@test-integration/utils';
import * as testDb from '../shared/test-db';
import * as utils from '../shared/utils';
let saveCredential: SaveCredentialFunction;

View File

@@ -1,10 +1,16 @@
import { createTeamProject } from '@n8n/backend-test-utils';
import {
createManyWorkflows,
createWorkflow,
shareWorkflowWithUsers,
} from '@n8n/backend-test-utils';
import { testDb } from '@n8n/backend-test-utils';
import { mockInstance } from '@n8n/backend-test-utils';
import type { User } from '@n8n/db';
import type { ExecutionEntity } from '@n8n/db';
import type { ActiveWorkflowManager } from '@/active-workflow-manager';
import { Telemetry } from '@/telemetry';
import { mockInstance } from '@test/mocking';
import { createTeamProject } from '@test-integration/db/projects';
import {
createErrorExecution,
@@ -14,12 +20,6 @@ import {
createWaitingExecution,
} from '../shared/db/executions';
import { createMemberWithApiKey, createOwnerWithApiKey } from '../shared/db/users';
import {
createManyWorkflows,
createWorkflow,
shareWorkflowWithUsers,
} from '../shared/db/workflows';
import * as testDb from '../shared/test-db';
import type { SuperAgentTest } from '../shared/types';
import * as utils from '../shared/utils/';

View File

@@ -1,13 +1,15 @@
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
import { Telemetry } from '@/telemetry';
import { mockInstance } from '@test/mocking';
import {
createTeamProject,
getProjectByNameOrFail,
linkUserToProject,
getAllProjectRelations,
getProjectRoleForUser,
} from '@test-integration/db/projects';
} from '@n8n/backend-test-utils';
import { testDb } from '@n8n/backend-test-utils';
import { mockInstance } from '@n8n/backend-test-utils';
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
import { Telemetry } from '@/telemetry';
import {
createMemberWithApiKey,
createOwnerWithApiKey,
@@ -15,8 +17,6 @@ import {
} from '@test-integration/db/users';
import { setupTestServer } from '@test-integration/utils';
import * as testDb from '../shared/test-db';
describe('Projects in Public API', () => {
const testServer = setupTestServer({ endpointGroups: ['publicApi'] });
mockInstance(Telemetry);

View File

@@ -1,10 +1,10 @@
import { testDb } from '@n8n/backend-test-utils';
import type { User } from '@n8n/db';
import { TagRepository } from '@n8n/db';
import { Container } from '@n8n/di';
import { createTag } from '../shared/db/tags';
import { createMemberWithApiKey, createOwnerWithApiKey } from '../shared/db/users';
import * as testDb from '../shared/test-db';
import type { SuperAgentTest } from '../shared/types';
import * as utils from '../shared/utils/';

View File

@@ -1,11 +1,12 @@
import { createTeamProject, linkUserToProject } from '@n8n/backend-test-utils';
import { testDb } from '@n8n/backend-test-utils';
import { mockInstance } from '@n8n/backend-test-utils';
import type { User } from '@n8n/db';
import { v4 as uuid } from 'uuid';
import validator from 'validator';
import { License } from '@/license';
import { createTeamProject, linkUserToProject } from '@test-integration/db/projects';
import { mockInstance } from '../../shared/mocking';
import {
createMember,
createMemberWithApiKey,
@@ -13,7 +14,6 @@ import {
createUser,
createUserShell,
} from '../shared/db/users';
import * as testDb from '../shared/test-db';
import type { SuperAgentTest } from '../shared/types';
import * as utils from '../shared/utils/';

View File

@@ -1,6 +1,8 @@
import { testDb } from '@n8n/backend-test-utils';
import { mockInstance } from '@n8n/backend-test-utils';
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
import { Telemetry } from '@/telemetry';
import { mockInstance } from '@test/mocking';
import {
createMember,
createMemberWithApiKey,
@@ -9,8 +11,6 @@ import {
} from '@test-integration/db/users';
import { setupTestServer } from '@test-integration/utils';
import * as testDb from '../shared/test-db';
describe('Users in Public API', () => {
const testServer = setupTestServer({ endpointGroups: ['publicApi'] });

View File

@@ -1,3 +1,4 @@
import { testDb } from '@n8n/backend-test-utils';
import type { User, Variables } from '@n8n/db';
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
@@ -5,8 +6,6 @@ import { createOwnerWithApiKey } from '@test-integration/db/users';
import { createVariable, getVariableByIdOrFail } from '@test-integration/db/variables';
import { setupTestServer } from '@test-integration/utils';
import * as testDb from '../shared/test-db';
describe('Variables in Public API', () => {
let owner: User;
const testServer = setupTestServer({ endpointGroups: ['publicApi'] });

View File

@@ -1,3 +1,7 @@
import { createTeamProject } from '@n8n/backend-test-utils';
import { createWorkflow, createWorkflowWithTrigger } from '@n8n/backend-test-utils';
import { testDb } from '@n8n/backend-test-utils';
import { mockInstance } from '@n8n/backend-test-utils';
import { GlobalConfig } from '@n8n/config';
import type { Project } from '@n8n/db';
import type { TagEntity } from '@n8n/db';
@@ -14,13 +18,9 @@ import { STARTING_NODES } from '@/constants';
import { ExecutionService } from '@/executions/execution.service';
import { ProjectService } from '@/services/project.service.ee';
import { Telemetry } from '@/telemetry';
import { createTeamProject } from '@test-integration/db/projects';
import { mockInstance } from '../../shared/mocking';
import { createTag } from '../shared/db/tags';
import { createMemberWithApiKey, createOwnerWithApiKey } from '../shared/db/users';
import { createWorkflow, createWorkflowWithTrigger } from '../shared/db/workflows';
import * as testDb from '../shared/test-db';
import type { SuperAgentTest } from '../shared/types';
import * as utils from '../shared/utils/';