From 21c3edf8d61d6f30511ba7b9386efc0771ffac65 Mon Sep 17 00:00:00 2001 From: Antoine Moreaux Date: Thu, 17 Apr 2025 16:49:57 +0200 Subject: [PATCH] =?UTF-8?q?fix(integration-tests):=20auth=20with=20multiwo?= =?UTF-8?q?rkspace=20and=20skip=20clickhouse=20=E2=80=A6=20(#11630)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …tests --- packages/twenty-server/jest-integration.config.ts | 9 ++++++--- .../clickhouse-event-registration.integration-spec.ts | 1 + .../graphql/suites/auth.integration-spec.ts | 11 +++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/twenty-server/jest-integration.config.ts b/packages/twenty-server/jest-integration.config.ts index 05b499db5..c5b8a5bbb 100644 --- a/packages/twenty-server/jest-integration.config.ts +++ b/packages/twenty-server/jest-integration.config.ts @@ -3,6 +3,7 @@ import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest'; import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface'; const isBillingEnabled = process.env.IS_BILLING_ENABLED === 'true'; +const isClickhouseEnabled = process.env.CLICKHOUSE_URL !== undefined; // eslint-disable-next-line @typescript-eslint/no-var-requires const tsConfig = require('./tsconfig.json'); @@ -16,9 +17,11 @@ const jestConfig: JestConfigWithTsJest = { moduleFileExtensions: ['js', 'json', 'ts'], rootDir: '.', testEnvironment: 'node', - testRegex: isBillingEnabled - ? '\\.integration-spec\\.ts$' - : '^(?!.*billing).*\\.integration-spec\\.ts$', + testPathIgnorePatterns: [ + ...(isBillingEnabled ? [] : ['/test/integration/billing']), + ...(isClickhouseEnabled ? [] : ['/test/integration/analytics']), + ], + testRegex: '\\.integration-spec\\.ts$', modulePathIgnorePatterns: ['/dist'], globalSetup: '/test/integration/utils/setup-test.ts', globalTeardown: '/test/integration/utils/teardown-test.ts', diff --git a/packages/twenty-server/test/integration/analytics/suites/clickhouse-event-registration.integration-spec.ts b/packages/twenty-server/test/integration/analytics/suites/clickhouse-event-registration.integration-spec.ts index e8924ef91..b5924d5f3 100644 --- a/packages/twenty-server/test/integration/analytics/suites/clickhouse-event-registration.integration-spec.ts +++ b/packages/twenty-server/test/integration/analytics/suites/clickhouse-event-registration.integration-spec.ts @@ -5,6 +5,7 @@ import { createClient, ClickHouseClient } from '@clickhouse/client'; import { GenericTrackEvent } from 'src/engine/core-modules/analytics/utils/events/track/track'; import { OBJECT_RECORD_CREATED_EVENT } from 'src/engine/core-modules/analytics/utils/events/track/object-record/object-record-created'; + describe('ClickHouse Event Registration (integration)', () => { let clickhouseClient: ClickHouseClient; diff --git a/packages/twenty-server/test/integration/graphql/suites/auth.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/auth.integration-spec.ts index ccbba0cbc..634a3ba34 100644 --- a/packages/twenty-server/test/integration/graphql/suites/auth.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/auth.integration-spec.ts @@ -4,6 +4,13 @@ const SERVER_URL = `http://localhost:${APP_PORT}`; const client = request(SERVER_URL); +const ORIGIN = new URL(SERVER_URL); + +ORIGIN.hostname = + process.env.IS_MULTIWORKSPACE_ENABLED === 'true' + ? `acme.${ORIGIN.hostname}` + : ORIGIN.hostname; + const auth = { email: 'tim@apple.dev', password: 'Applecar2025', @@ -28,7 +35,7 @@ describe('AuthResolve (integration)', () => { return client .post('/graphql') - .set('Origin', SERVER_URL) + .set('Origin', ORIGIN.toString()) .send(queryData) .expect(200) .expect((res) => { @@ -62,7 +69,7 @@ describe('AuthResolve (integration)', () => { return client .post('/graphql') - .set('Origin', SERVER_URL) + .set('Origin', ORIGIN.toString()) .send(queryData) .expect(200) .expect((res) => {