Skip to content

Commit

Permalink
test: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
collettemathieu committed Oct 1, 2024
1 parent 2223b8b commit 22fbe6a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 68 deletions.
7 changes: 6 additions & 1 deletion apps/pathway-design/server/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Module } from '@nestjs/common';

import { PDSPIAInitializePathwayInterfaceAdaptersModule } from '@bewoak/pathway-design-server-pathway-interface-adapters';
import {
PDSPIAChangeTitlePathwayInterfaceAdaptersModule,
PDSPIAInitializePathwayInterfaceAdaptersModule,
} from '@bewoak/pathway-design-server-pathway-interface-adapters';
import { PDSPPPathwayPresentersModule } from '@bewoak/pathway-design-server-pathway-presenters';
import { CqrsModule } from '@nestjs/cqrs';

@Module({
imports: [
PDSPIAChangeTitlePathwayInterfaceAdaptersModule.withPresenter(PDSPPPathwayPresentersModule.use('toJson')).build(),
PDSPIAInitializePathwayInterfaceAdaptersModule.withPresenter(PDSPPPathwayPresentersModule.use('toJson')).build(),
CqrsModule.forRoot(),
CqrsModule.forRoot(),
],
controllers: [],
providers: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { strict as assert } from 'node:assert';
import type { Http2Server } from 'node:http2';
import {
PDSPIAChangeTitlePathwayInterfaceAdaptersModule,
PDSPIAInitializePathwayInterfaceAdaptersModule,
Expand All @@ -10,6 +8,8 @@ import type { INestApplication } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { Test } from '@nestjs/testing';
import { binding, given, then, when } from 'cucumber-tsflow';
import { strict as assert } from 'node:assert';
import type { Http2Server } from 'node:http2';
import request from 'supertest';

@binding()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { strict as assert } from 'node:assert';
import type { Http2Server } from 'node:http2';
import { PDSPIAInitializePathwayInterfaceAdaptersModule } from '@bewoak/pathway-design-server-pathway-interface-adapters';
import { PDSPPPathwayPresentersModule } from '@bewoak/pathway-design-server-pathway-presenters';
import type { DataTable } from '@cucumber/cucumber';
import type { INestApplication } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { Test } from '@nestjs/testing';
import { binding, given, then, when } from 'cucumber-tsflow';
import { strict as assert } from 'node:assert';
import type { Http2Server } from 'node:http2';
import request from 'supertest';

@binding()
Expand All @@ -22,6 +22,7 @@ class ControllerSteps {
PDSPIAInitializePathwayInterfaceAdaptersModule.withPresenter(PDSPPPathwayPresentersModule.use('toJson')).build(),
CqrsModule.forRoot(),
],
exports: [],
}).compile();

this.app = testingModule.createNestApplication();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,51 +1,44 @@
import { Module } from '@nestjs/common';
import { Module, type Provider } from '@nestjs/common';

import {
PDSPBP_CHANGE_TITLE_PATHWAY_PERSISTENCE_PORT,
PDSPBP_INITIALIZE_PATHWAY_PERSISTENCE_PORT,
} from '@bewoak/pathway-design-server-pathway-business';
import { ChangeTitlePathwayInMemoryPersistenceModule } from './change-title/in-memory/change-title-pathway-in-memory-persistence.module';
import { ChangeTitlePathwayInMemoryPersistence } from './change-title/in-memory/change-title-pathway-in-memory.persistence';
import { PathwayInMemoryRepository } from './common/in-memory/repositories/in-memory-pathway.repository';
import { InitializePathwayInMemoryPersistenceModule } from './initialize/in-memory/initialize-pathway-in-memory-persistence.module';
import { InitializePathwayInMemoryPersistence } from './initialize/in-memory/initialize-pathway-in-memory.persistence';

const persistenceDriverModulesMap: Record<
'inMemory',
[typeof InitializePathwayInMemoryPersistenceModule, typeof ChangeTitlePathwayInMemoryPersistenceModule]
> = {
inMemory: [InitializePathwayInMemoryPersistenceModule, ChangeTitlePathwayInMemoryPersistenceModule],
const persistenceProvidersMap: Record<'inMemory', Provider[]> = {
inMemory: [
InitializePathwayInMemoryPersistence,
{
provide: PDSPBP_INITIALIZE_PATHWAY_PERSISTENCE_PORT,
useExisting: InitializePathwayInMemoryPersistence,
},
ChangeTitlePathwayInMemoryPersistence,
{
provide: PDSPBP_CHANGE_TITLE_PATHWAY_PERSISTENCE_PORT,
useExisting: ChangeTitlePathwayInMemoryPersistence,
},
PathwayInMemoryRepository,
],
};

const persistenceProvidersMap: Record<'inMemory', [typeof PathwayInMemoryRepository]> = {
inMemory: [PathwayInMemoryRepository],
};

type PersistenceDriverAuthorized = keyof typeof persistenceDriverModulesMap;
type PersistenceDriverAuthorized = keyof typeof persistenceProvidersMap;

@Module({})
// biome-ignore lint/complexity/noStaticOnlyClass: not pertinent here because this is a module
export class PDSPIPPathwayPersistenceInfrastructureModule {
constructor() {
console.log('PDSPIPPathwayPersistenceInfrastructureModule constructor');
}

static use(driver: PersistenceDriverAuthorized) {
const _persistenceModules = persistenceDriverModulesMap[driver];
const _persistenceProviders = persistenceProvidersMap[driver];
const persistenceProviders = persistenceProvidersMap[driver];

return {
module: PDSPIPPathwayPersistenceInfrastructureModule,
providers: [
InitializePathwayInMemoryPersistence,
{
provide: PDSPBP_INITIALIZE_PATHWAY_PERSISTENCE_PORT,
useExisting: InitializePathwayInMemoryPersistence,
},
ChangeTitlePathwayInMemoryPersistence,
{
provide: PDSPBP_CHANGE_TITLE_PATHWAY_PERSISTENCE_PORT,
useExisting: ChangeTitlePathwayInMemoryPersistence,
},
PathwayInMemoryRepository,
],
imports: [],
providers: [...persistenceProviders],
exports: [PDSPBP_INITIALIZE_PATHWAY_PERSISTENCE_PORT, PDSPBP_CHANGE_TITLE_PATHWAY_PERSISTENCE_PORT],
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ export class PDSPIAChangeTitlePathwayInterfaceAdaptersModule {
return {
module: PDSPIAChangeTitlePathwayInterfaceAdaptersModule,
imports: [
PDSPIPPathwayPersistenceInfrastructureModule.use('inMemory'),
...PDSPIAChangeTitlePathwayInterfaceAdaptersModule.imports,
PDSPIPPathwayPersistenceInfrastructureModule.use('inMemory'),
],
exports: [PDSPIAChangeTitlePathwayInterfaceAdaptersModule],
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ export class PDSPIAInitializePathwayInterfaceAdaptersModule {
return {
module: PDSPIAInitializePathwayInterfaceAdaptersModule,
imports: [
PDSPIPPathwayPersistenceInfrastructureModule.use('inMemory'),
...PDSPIAInitializePathwayInterfaceAdaptersModule.imports,
PDSPIPPathwayPersistenceInfrastructureModule.use('inMemory'),
],
exports: [PDSPIAInitializePathwayInterfaceAdaptersModule],
};
}
}

0 comments on commit 22fbe6a

Please sign in to comment.