-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be3a086
commit 2223b8b
Showing
32 changed files
with
288 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
apps/pathway-design/server/src/specs/change-title-pathway/index.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: Change the title of a pathway in a memory database with json presenter | ||
|
||
Scenario: I want to change the title of a learning pathway | ||
Given I am authenticated on the platform for change the title of the pathway in memory persistence and json presenter | ||
Given I have a pathway recorded in memory with these data | ||
| title | description | researchField | | ||
| My Pathway | A test pathway | biology | | ||
When I want to change the title of the pathway in memory to "My New Pathway" | ||
Then I should receive from memory the new title of the pathway | ||
| title | | ||
| My New Pathway | | ||
|
62 changes: 62 additions & 0 deletions
62
apps/pathway-design/server/src/specs/change-title-pathway/index.step.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { strict as assert } from 'node:assert'; | ||
import type { Http2Server } from 'node:http2'; | ||
import { | ||
PDSPIAChangeTitlePathwayInterfaceAdaptersModule, | ||
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 request from 'supertest'; | ||
|
||
@binding() | ||
class ControllerSteps { | ||
private app: INestApplication; | ||
private httpServer: Http2Server; | ||
private response: request.Response; | ||
|
||
@given('I am authenticated on the platform for change the title of the pathway in memory persistence and json presenter') | ||
public async withInMemoryPeristenceAndJsonPresenter() { | ||
const testingModule = await Test.createTestingModule({ | ||
imports: [ | ||
PDSPIAChangeTitlePathwayInterfaceAdaptersModule.withPresenter(PDSPPPathwayPresentersModule.use('toJson')).build(), | ||
PDSPIAInitializePathwayInterfaceAdaptersModule.withPresenter(PDSPPPathwayPresentersModule.use('toJson')).build(), | ||
CqrsModule.forRoot(), | ||
], | ||
}).compile(); | ||
|
||
this.app = testingModule.createNestApplication(); | ||
await this.app.init(); | ||
this.httpServer = this.app.getHttpServer(); | ||
} | ||
|
||
@given('I have a pathway recorded in memory with these data') | ||
public async givenIHaveAPathwayRecordedInMemroy(dataTable: DataTable) { | ||
const firstRow = dataTable.hashes()[0]; | ||
|
||
this.response = await request(this.httpServer).post('/pathway/init').send({ | ||
title: firstRow.title, | ||
description: firstRow.description, | ||
researchField: firstRow.researchField, | ||
}); | ||
} | ||
|
||
@when('I want to change the title of the pathway in memory to {string}') | ||
public async whenIChangeTheTitleOfThePathwayTo(title: string) { | ||
this.response = await request(this.httpServer).patch(`/pathway/change-title/${this.response.body.id}`).send({ | ||
title, | ||
}); | ||
} | ||
|
||
@then('I should receive from memory the new title of the pathway') | ||
public async thenIShouldReceiveTheNewTitleOfThePathway(dataTable: DataTable) { | ||
const firstRow = dataTable.hashes()[0]; | ||
|
||
assert.strictEqual(this.response.body.title, firstRow.title); | ||
} | ||
} | ||
|
||
export = ControllerSteps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../business/src/lib/ports/persistences/change-title/change-title-pathway-persitence.port.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { PDSPBEPathwayEntity } from '../../../entities/pathway'; | ||
|
||
export interface PDSPBPChangeTitlePathwayPersistencePort { | ||
changeTitle: (pDSPBEPathwayEntity: PDSPBEPathwayEntity, title: string) => Promise<PDSPBEPathwayEntity>; | ||
changeTitle: (pathwayId: string, title: string) => Promise<PDSPBEPathwayEntity>; | ||
} | ||
|
||
export const PDSPBP_CHANGE_TITLE_PATHWAY_PERSISTENCE_PORT = Symbol('PDSPBPChangeTitlePathwayPersistencePort'); |
2 changes: 1 addition & 1 deletion
2
...way-design/server/pathway/business/src/lib/specs/change-name/change-title-pathway.step.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...athway-design/server/pathway/business/src/lib/specs/initialize/initialize-pathway.step.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { PDSPIInitializePathwayPersistenceInfrastructureModule } from './lib/persistence/initialize/initialize-pathway-persistence-infrastructure.module'; | ||
export { PDSPIPPathwayPersistenceInfrastructureModule } from './lib/persistence/pathway-persistence-infrastructure.module'; |
22 changes: 0 additions & 22 deletions
22
...rc/lib/persistence/change-title/change-title-pathway-persistence-infrastructure.module.ts
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
...b/persistence/change-title/in-memory/change-title-pathway-in-memory-persistence.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.