feat: add service window component and related functionality
- Introduced ServiceWindow component to display the last departure today and the first tomorrow. - Implemented cancellation notice parsing to handle route cancellations effectively. - Enhanced departure display logic to include cancellation alerts and status updates. - Created information blocks for displaying service information, weather, and QR codes. - Added tests for departure features, information handling, and service window functionality. - Updated fixtures for testing various scenarios including cancellations and long wait times.
This commit is contained in:
@@ -85,6 +85,14 @@ test('city and platform identity are checked before restoring a snapshot', () =>
|
||||
assert.equal(isBoardData(data, 1, 2), false);
|
||||
assert.equal(isBoardData({ ...data, mode: 'demo' }, 1, 1), false);
|
||||
});
|
||||
test('malformed cancellation targets in a saved snapshot are rejected instead of cancelling unrelated trips', () => {
|
||||
const target = { routeNumber: '5', stopId: 1, serviceDate: '2026-10-08', time: '12:35' };
|
||||
const alert = { id: '1', routeIds: [37], routeNumbers: ['5'], cancellations: [target] };
|
||||
const snapshot = { ...makeSnapshot(), alerts: [alert] };
|
||||
assert.equal(isBoardData(snapshot, 1, 1), true);
|
||||
for (const damaged of [null, { ...target, stopId: -1 }, { ...target, serviceDate: '2026-02-31' }, { ...target, time: '25:00' }])
|
||||
assert.equal(isBoardData({ ...snapshot, alerts: [{ ...alert, cancellations: [damaged] }] }, 1, 1), false);
|
||||
});
|
||||
test('route filtering and transport priority use absolute arrival time', () => {
|
||||
const data = makeSnapshot();
|
||||
assert.equal(upcomingDepartures(data, now, '88').length, 0);
|
||||
|
||||
Reference in New Issue
Block a user