Skip to content

Commit

Permalink
fix: While combining two trainruns the first trainrun will "survive" …
Browse files Browse the repository at this point in the history
…and the second one will be deleted. If the trainrun which will be deleted consists of more than one trainrun segment (connected paths) the reported issue will be generated. (Test added)
  • Loading branch information
aiAdrian committed Nov 4, 2024
1 parent 3bb9376 commit c55388b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/app/services/data/trainrun.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,46 @@ describe("TrainrunService", () => {
expect(trainrunSections4.length).toBe(2);
});

it("combineTwoTrainruns - 002 - two trainrun segments tests", () => {
dataService.loadNetzgrafikDto(
NetzgrafikUnitTesting.getUnitTestNetzgrafik(),
);

trainrunSectionService.deleteTrainrunSection(4);

const ts5: TrainrunSection =
trainrunSectionService.getTrainrunSectionFromId(5);
const ts7: TrainrunSection =
trainrunSectionService.getTrainrunSectionFromId(7);

const node2: Node = nodeService.getNodeFromId(2);

const trainrunSections5 =
trainrunSectionService.getAllTrainrunSectionsForTrainrun(
ts5.getTrainrunId(),
);
const trainrunSections7 =
trainrunSectionService.getAllTrainrunSectionsForTrainrun(
ts7.getTrainrunId(),
);

trainrunService.combineTwoTrainruns(
node2,
node2.getPortOfTrainrunSection(7),
node2.getPortOfTrainrunSection(5),
);

const trainrunSections75 =
trainrunSectionService.getAllTrainrunSectionsForTrainrun(
ts7.getTrainrunId(),
);

expect(trainrunSections75.length).toBe(
trainrunSections5.length +
trainrunSections7.length);
expect(trainrunSections75.length).toBe(3);
});

it("getRootIterators", () => {
dataService.loadNetzgrafikDto(
NetzgrafikUnitTesting.getUnitTestNetzgrafik(),
Expand Down

0 comments on commit c55388b

Please sign in to comment.