-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front: adapt simulation results for trainschedule v2
- Loading branch information
1 parent
3203aa3
commit 625d185
Showing
65 changed files
with
5,534 additions
and
722 deletions.
There are no files selected for viewing
556 changes: 556 additions & 0 deletions
556
front/src/applications/operationalStudies/__tests__/sampleData.ts
Large diffs are not rendered by default.
Oops, something went wrong.
111 changes: 111 additions & 0 deletions
111
front/src/applications/operationalStudies/__tests__/utils.spec.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,111 @@ | ||
import { | ||
formatElectrificationRanges, | ||
formatPowerRestrictionRanges, | ||
formatPowerRestrictionRangesWithHandled, | ||
transformBoundariesDataToPositionDataArray, | ||
transformBoundariesDataToRangesData, | ||
} from 'applications/operationalStudies/utils'; | ||
|
||
import { | ||
boundariesDataWithElectrificalProfile, | ||
boundariesDataWithElectrification, | ||
boundariesDataWithNumber, | ||
effortCurves, | ||
electricalProfileRangesData, | ||
electricalProfileRangesDataShort, | ||
electrificationRanges, | ||
electrificationRangesData, | ||
electrificationRangesDataLarge, | ||
electrificationRangesForPowerRestrictions, | ||
electrificationRangesLarge, | ||
formattedPowerRestrictionRanges, | ||
getExpectedResultDataNumber, | ||
pathLength, | ||
powerRestriction, | ||
powerRestrictionRanges, | ||
powerRestrictionRangesWithHandled, | ||
stepPath, | ||
stepPathPositions, | ||
} from './sampleData'; | ||
|
||
describe('transformBoundariesDataToPositionDataArray', () => { | ||
it('should transform boundaries data to position data array for gradient', () => { | ||
const result = transformBoundariesDataToPositionDataArray( | ||
boundariesDataWithNumber, | ||
pathLength, | ||
'gradient' | ||
); | ||
|
||
expect(result).toEqual(getExpectedResultDataNumber('gradient')); | ||
}); | ||
|
||
it('should transform boundaries data to position data array for radius', () => { | ||
const result = transformBoundariesDataToPositionDataArray( | ||
boundariesDataWithNumber, | ||
pathLength, | ||
'radius' | ||
); | ||
|
||
expect(result).toEqual(getExpectedResultDataNumber('radius')); | ||
}); | ||
}); | ||
|
||
describe('transformBoundariesDataToRangesData', () => { | ||
it('should transform boundaries data to ranges data for electrification', () => { | ||
const result = transformBoundariesDataToRangesData( | ||
boundariesDataWithElectrification, | ||
pathLength | ||
); | ||
|
||
expect(result).toEqual(electrificationRangesData); | ||
}); | ||
|
||
it('should transform boundaries data to ranges data for electrical profile', () => { | ||
const result = transformBoundariesDataToRangesData( | ||
boundariesDataWithElectrificalProfile, | ||
pathLength | ||
); | ||
|
||
expect(result).toEqual(electricalProfileRangesData); | ||
}); | ||
}); | ||
|
||
describe('formatElectrificationRanges', () => { | ||
it('should properly format electrification ranges if both parameters have same length', () => { | ||
const result = formatElectrificationRanges( | ||
electrificationRangesData, | ||
electricalProfileRangesData | ||
); | ||
|
||
expect(result).toEqual(electrificationRanges); | ||
}); | ||
|
||
it('should properly format electrification ranges if electrification is longer than electrical profiles', () => { | ||
const result = formatElectrificationRanges( | ||
electrificationRangesDataLarge, | ||
electricalProfileRangesDataShort | ||
); | ||
|
||
expect(result).toEqual(electrificationRangesLarge); | ||
}); | ||
}); | ||
|
||
describe('formatPowerRestrictionRanges', () => { | ||
it('should properly format power restrictions ranges', () => { | ||
const result = formatPowerRestrictionRanges(powerRestriction, stepPath, stepPathPositions); | ||
|
||
expect(result).toEqual(formattedPowerRestrictionRanges); | ||
}); | ||
}); | ||
|
||
describe('formatPowerRestrictionRangesWithHandled', () => { | ||
it('should properly format power restrictions ranges with handled property', () => { | ||
const result = formatPowerRestrictionRangesWithHandled( | ||
powerRestrictionRanges, | ||
electrificationRangesForPowerRestrictions, | ||
effortCurves | ||
); | ||
|
||
expect(result).toEqual(powerRestrictionRangesWithHandled); | ||
}); | ||
}); |
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.