Files
twenty/packages/twenty-server/test/integration/utils/setup-test.ts
T
WeikoandGitHub dec2239ae7 Remove typeorm service (#14116)
## Context
To simplify the way we inject our default datasource, I've recently
removed the token injection that was confusion since we only had once
configured on the module level. Now I'm removing TypeORM service which
allows us to instantiate a new Datasource with the same parameters as
the default one, it was redundant and confusing.
2025-08-28 13:21:26 +02:00

31 lines
1.1 KiB
TypeScript

import { type JestConfigWithTsJest } from 'ts-jest';
import 'tsconfig-paths/register';
import { DataSeedWorkspaceCommand } from 'src/database/commands/data-seed-dev-workspace.command';
import { rawDataSource } from 'src/database/typeorm/raw/raw.datasource';
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
import { createApp } from './create-app';
// @ts-expect-error legacy noImplicitAny
export default async (_, projectConfig: JestConfigWithTsJest) => {
const app = await createApp({});
if (!projectConfig.globals) {
throw new Error('No globals found in project config');
}
await rawDataSource.initialize();
await app.listen(projectConfig.globals.APP_PORT);
// @ts-expect-error legacy noImplicitAny
global.app = app;
// @ts-expect-error legacy noImplicitAny
global.testDataSource = rawDataSource;
// @ts-expect-error legacy noImplicitAny
global.dataSourceService = app.get(DataSourceService);
// @ts-expect-error legacy noImplicitAny
global.dataSeedWorkspaceCommand = app.get(DataSeedWorkspaceCommand);
};