Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Akctarus committed Jul 17, 2024
1 parent 537d57d commit 20362be
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 153 deletions.
108 changes: 0 additions & 108 deletions front/src/applications/stdcm/utils/__tests__/sampleData.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import {
computeStopDepartureTime,
addMinutesToTime,
getStopDurationBetweenTwoPositions,
getOperationalPointsWithTimes,
} from 'applications/stdcm/utils/formatSimulationReportSheet';

import { suggestedOperationalPoints, simulation, departure_time } from './sampleData';

// TODO: When the code will be generated based on stdcm inputs hash, we will need to adapt this test
describe('Utils simulation report sheet functions', () => {
test('should return a formatted string', () => {
Expand All @@ -20,6 +17,7 @@ describe('Utils simulation report sheet functions', () => {

// TODO DROP STDCM V1
test('should format the date correctly', () => {
const departure_time = '2024-07-08T10:20:30Z';
const formattedDate = formatCreationDate(departure_time);
expect(formattedDate).toEqual({
day: '08',
Expand All @@ -42,48 +40,6 @@ describe('Utils simulation report sheet functions', () => {
expect(extractSpeedLimit(speedLimitByTag2)).toBe('Voyageurs');
});

test('should return formatted operational points with times', () => {
const result = getOperationalPointsWithTimes(
suggestedOperationalPoints,
simulation,
departure_time
);
expect(result).toEqual([
{
opId: 'op1',
positionOnPath: 50,
time: '10:20',
name: 'Point 1',
ch: 'Ch1',
duration: 0,
departureTime: '2024-07-08T10:20:30Z',
stopEndTime: '10:20',
trackName: 'Track 1',
},
{
opId: 'op2',
positionOnPath: 100,
time: '10:21',
name: 'Point 2',
ch: 'Ch2',
duration: 120,
departureTime: '2024-07-08T10:20:30Z',
stopEndTime: '10:23',
trackName: 'Track 2',
},
{
opId: 'op3',
positionOnPath: 150,
time: '10:24',
name: 'Point 3',
ch: 'Ch3',
duration: 0,
departureTime: '2024-07-08T10:20:30Z',
stopEndTime: '10:24',
trackName: 'Track 3',
},
]);
});
test('should compute stop departure time correctly', () => {
expect(computeStopDepartureTime('10:30', '15:00')).toBe('10:45');
expect(computeStopDepartureTime('23:59', '01:00')).toBe('00:00');
Expand Down

0 comments on commit 20362be

Please sign in to comment.