mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 09:58:12 +00:00
feat: enhance booking and scheduling features with shipping line support and improved search functionality
This commit is contained in:
@@ -1821,5 +1821,31 @@ describe('TrainSchedulingService', () => {
|
||||
expect(written.windowPhase).toBeUndefined();
|
||||
expect(written.windowOpensAt).toBeUndefined();
|
||||
});
|
||||
|
||||
it('moves an OPEN export close to the new departure but keeps the open', async () => {
|
||||
const opensAt = new Date('2027-06-19T03:00:00.000Z');
|
||||
trainSchedulesRepository.findByIdWithFullGraph.mockResolvedValue(
|
||||
doneExportSchedule({
|
||||
windowPhase: 'OPEN',
|
||||
bookingWindowStatus: 'OPEN',
|
||||
windowOpensAt: opensAt,
|
||||
windowClosesAt: new Date('2027-06-20T03:00:00.000Z'),
|
||||
}),
|
||||
);
|
||||
|
||||
// Departure pushed 3 days later → close = new departure − 120min; the
|
||||
// open customers already booked against stays untouched.
|
||||
await service.maintenanceReschedule('sch-done', {
|
||||
newDepartureDate: '2027-06-23T05:00:00.000Z',
|
||||
} as never);
|
||||
|
||||
const written = scheduleUpdate.mock.calls[0][1];
|
||||
expect(written.scheduledDepartureDate).toEqual(
|
||||
new Date('2027-06-23T05:00:00.000Z'),
|
||||
);
|
||||
expect(written.windowClosesAt).toEqual(new Date('2027-06-23T03:00:00.000Z'));
|
||||
expect(written.windowOpensAt).toBeUndefined();
|
||||
expect(written.windowPhase).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user