Skip to content

The open alternative to Salesforce, designed for AI.

fix(integration-tests): auth with multiworkspace and skip clickhouse … (#11630)

Antoine Moreaux21c3edf8d61d
diff --git a/packages/twenty-server/jest-integration.config.ts b/packages/twenty-server/jest-integration.config.ts
index 05b499db568..c5b8a5bbb6f 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 ? [] : ['<rootDir>/test/integration/billing']),
+ ...(isClickhouseEnabled ? [] : ['<rootDir>/test/integration/analytics']),
+ ],
+ testRegex: '\\.integration-spec\\.ts$',
modulePathIgnorePatterns: ['<rootDir>/dist'],
globalSetup: '<rootDir>/test/integration/utils/setup-test.ts',
globalTeardown: '<rootDir>/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 e8924ef9148..b5924d5f35d 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 ccbba0cbc87..634a3ba34e1 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 = {
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) => {