Skip to content

Commit

Permalink
- edited stdcm tests after modification
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu <[email protected]>
  • Loading branch information
Caracol3 committed Dec 10, 2024
1 parent bb737dc commit 7bb63f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions front/src/applications/stdcm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export type StdcmConfigCardProps = {
export enum ArrivalTimeTypes {
PRECISE_TIME = 'preciseTime',
ASAP = 'asSoonAsPossible',
RESPECT_DESTINATION_SCHEDULE = 'respectDestinationSchedule',
}

export enum StdcmConfigErrorTypes {
Expand Down
11 changes: 7 additions & 4 deletions front/src/applications/stdcm/utils/checkStdcmConfigErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ const checkStdcmConfigErrors = (
return { errorType: StdcmConfigErrorTypes.PATHFINDING_FAILED };
}

const areBothPointsASAP =
origin.arrivalType === ArrivalTimeTypes.ASAP &&
destination.arrivalType === ArrivalTimeTypes.ASAP;
const isOriginRespectDestinationSchedule =
origin.arrivalType === ArrivalTimeTypes.RESPECT_DESTINATION_SCHEDULE;

if (areBothPointsASAP) {
const isDestinationASAP = destination.arrivalType === ArrivalTimeTypes.ASAP;

const areBothPointsNotSchedule = isOriginRespectDestinationSchedule && isDestinationASAP;

if (areBothPointsNotSchedule) {
return { errorType: StdcmConfigErrorTypes.NO_SCHEDULED_POINT };
}

Expand Down
2 changes: 1 addition & 1 deletion front/tests/pages/stdcm-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class STDCMPage {
await expect(this.timeOriginArrival).toHaveValue('');
await expect(this.toleranceOriginArrival).toHaveValue('-30/+30');
await this.dynamicOriginCh.selectOption('BC');
await this.originArrival.selectOption('asSoonAsPossible');
await this.originArrival.selectOption('respectDestinationSchedule');
await expect(this.dateOriginArrival).not.toBeVisible();
await expect(this.timeOriginArrival).not.toBeVisible();
await expect(this.toleranceOriginArrival).not.toBeVisible();
Expand Down

0 comments on commit 7bb63f6

Please sign in to comment.