Skip to content

Commit

Permalink
fixup! front: remove opTimingData from StdcmOpSchedule and simplify d…
Browse files Browse the repository at this point in the history
…ate management
  • Loading branch information
clarani committed Jan 9, 2025
1 parent c6a47d0 commit d4ad536
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions front/tests/utils/setup-utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import dayjs from 'dayjs';

import type {
Infra,
PostInfraRailjsonApiResponse,
Expand Down Expand Up @@ -137,6 +139,10 @@ export async function createStudy(projectId: number, studyName = globalStudyName

return study;
}

const createDateInSpecialTimeZone = (dateString: string, timeZone: string) =>
dayjs.tz(dateString, timeZone);

/**
* Main function to create all necessary test data including infrastructure, rolling stocks,
* project, study, and scenario.
Expand Down Expand Up @@ -177,8 +183,14 @@ export async function createDataForTests(): Promise<void> {

const stdcmEnvironment = {
infra_id: smallInfra.id,
search_window_begin: new Date('2024-10-17T00:00:01+02:00').toISOString(),
search_window_end: new Date('2024-10-18T23:59:59+02:00').toISOString(),
search_window_begin: createDateInSpecialTimeZone(
'2024-10-17T00:00:00',
'Europe/Paris'
).toISOString(),
search_window_end: createDateInSpecialTimeZone(
'2024-10-18T23:59:59',
'Europe/Paris'
).toISOString(),
timetable_id: scenarioTrainSchedule.timetable_id,
} as StdcmSearchEnvironment;

Expand Down

0 comments on commit d4ad536

Please sign in to comment.