Skip to content

Commit

Permalink
Add tests for get_vehicle_schedules_on_date function.
Browse files Browse the repository at this point in the history
We also add one substitute operating day to additional datasets. In the last part of the tests,
we modify the one dataset in the test to avoid adding 5-10 different dataset just to change one
or two attributes.
  • Loading branch information
HenrikHartiala committed Jul 11, 2023
1 parent b05ad67 commit f0391a9
Show file tree
Hide file tree
Showing 5 changed files with 1,336 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/hasura/generic/timetablesdb/datasets/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type UUID = string;
export enum TimetablePriority {
Standard = 10, // used for "normal" in-use entities
Temporary = 20, // overrides Standard, used for temporary adjustments
SubstituteOperatingDayByLineType = 23, // overrides standard and temporary
Special = 25, // special day that overrides Standard and Temporary
Draft = 30, // overrides Special, Temporary and Standard, not visible to external systems
Staging = 40, // imported from Hastus, not in use until priority is changed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TypeOfLine } from 'generic/networkdb/datasets/types';
import { DateTime } from 'luxon';
import { HslTimetablesDbTables } from '../../schema';
import { DayOfWeek } from '../../types';

export const stoppingBusServiceThursday20230406SubstituteOperatingDayByLineType =
{
substitute_operating_day_by_line_type_id:
'5d7a31de-1236-4c94-b737-509bae0ea578',
type_of_line: TypeOfLine.StoppingBusService,
superseded_date: DateTime.fromISO('2023-04-06'),
substitute_day_of_week: DayOfWeek.Sunday,
};

export const stoppingBusServiceSaturday20230406Dataset: TableData<HslTimetablesDbTables>[] =
[
{
name: 'service_calendar.substitute_operating_day_by_line_type',
data: [
stoppingBusServiceThursday20230406SubstituteOperatingDayByLineType,
],
},
];
11 changes: 11 additions & 0 deletions test/hasura/hsl/timetablesdb/datasets/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ export type TimetableVersion = {
validity_start: DateTime;
validity_end: DateTime;
};

export type VehicleSchedule = {
vehicle_journey_id: UUID | null;
vehicle_schedule_frame_id: UUID | null;
substitute_operating_day_by_line_type_id: UUID | null;
priority: TimetablePriority;
day_type_id: UUID;
validity_start: DateTime;
validity_end: DateTime;
created_at: DateTime;
};
Loading

0 comments on commit f0391a9

Please sign in to comment.