mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 10:44:23 +00:00
feat(roadtrip): hire car desks, bookings under stops, the ride as one block
A hire car is no seam, but its desks are where the drive starts and ends: the pick-up opens its day when nothing timed comes first, the return closes the day it is handed back on, the road runs through both and the range budget starts from a full tank at the pick-up. The return is only placed when the booking names a return day and a located return desk. A table, tickets or a tour on the day hang under the stop they are pinned to or booked at as chips that open the booking; one for no stop is listed under the day. A ride that leaves and lands on the same day is one block on the rail and in the phone chain, not two terminal rows and a band. Both shells read the same helpers (carrierRide, stopBookings, roadtripRowModel). Server reads car bookings into the plan context; the MCP descriptions say so. The pt-BR locale had the three ride strings in Breton, fixed alongside. Refs #2428
This commit is contained in:
@@ -536,23 +536,50 @@ describe('roadtripRows with a ride (#2428)', () => {
|
||||
legs: [seg(0), ride, seg(2)],
|
||||
})
|
||||
|
||||
it('FE-RTROW-045: the terminals are stop rows without a number, and the numbering skips them', () => {
|
||||
const rows = stopRows(roadtripRows(flightDay()))
|
||||
expect(rows.map(r => [r.stop.name, r.number])).toEqual([
|
||||
it('FE-RTROW-045: a same-day ride is one row holding both terminals, unnumbered, and the numbering skips them', () => {
|
||||
const rows = roadtripRows(flightDay())
|
||||
expect(stopRows(rows).map(r => [r.stop.name, r.number])).toEqual([
|
||||
['Bremen', 1],
|
||||
['Munich Airport', null],
|
||||
['Hamburg Airport', null],
|
||||
['Hotel', 2],
|
||||
])
|
||||
const rideRow = rows.find(r => r.kind === 'ride')
|
||||
expect(rideRow?.kind === 'ride' && [rideRow.departure.stop.name, rideRow.departure.number, rideRow.arrival.stop.name, rideRow.arrival.number])
|
||||
.toEqual(['Munich Airport', null, 'Hamburg Airport', null])
|
||||
expect(destinationCount(flightDay())).toBe(2)
|
||||
})
|
||||
|
||||
it('FE-RTROW-046: between a departure and its arrival the row is the ride, not a leg; the road out of the arrival is a leg', () => {
|
||||
it('FE-RTROW-046: the ride row stands where the departure stood and carries the booking; the road out of the arrival follows it as a leg', () => {
|
||||
const rows = roadtripRows(flightDay())
|
||||
expect(rows.map(r => r.kind)).toEqual(['stop', 'leg', 'stop', 'ride', 'stop', 'leg', 'stop'])
|
||||
const rideRow = rows[3]
|
||||
expect(rows.map(r => r.kind)).toEqual(['stop', 'leg', 'ride', 'leg', 'stop'])
|
||||
const rideRow = rows[2]
|
||||
expect(rideRow.kind === 'ride' && rideRow.carrier.title).toBe('LH 2020')
|
||||
expect(rideRow.kind === 'ride' && rideRow.seg).toBe(ride)
|
||||
expect(rideRow.kind === 'ride' && rideRow.arrival.time).toBe(rideRow.kind === 'ride' ? rideRow.arrival.entry?.arrival ?? null : null)
|
||||
// The leg after the ride is the arrival's, at the arrival's index.
|
||||
expect(rows[3]).toMatchObject({ kind: 'leg', index: 2 })
|
||||
})
|
||||
|
||||
it('FE-RTROW-049: a ride landing tomorrow leaves its departure as a lone stop row, and the arrival opens the next day as one', () => {
|
||||
const rows = roadtripRows(day([stop('Bremen'), terminal('Munich Airport', 'departure')], { legs: [seg(0)] }))
|
||||
expect(rows.map(r => r.kind)).toEqual(['stop', 'leg', 'stop'])
|
||||
const landing = roadtripRows(day([terminal('Hamburg Airport', 'arrival', '07:00'), stop('Hotel')], { legs: [seg(0)] }))
|
||||
expect(landing.map(r => r.kind)).toEqual(['stop', 'leg', 'stop'])
|
||||
expect(stopRows(landing).map(r => [r.stop.name, r.number])).toEqual([['Hamburg Airport', null], ['Hotel', 1]])
|
||||
})
|
||||
|
||||
it('FE-RTROW-050: a hire car\'s desks are unnumbered stop rows the road runs through', () => {
|
||||
const desk = (name: string, role: 'pickup' | 'return') =>
|
||||
stop(name, {
|
||||
assignmentId: role === 'pickup' ? -3000000018 : -3000000019,
|
||||
placeId: -9,
|
||||
carrier: { reservationId: 9, type: 'car', role, title: 'Sixt', code: null, at: '09:00' },
|
||||
})
|
||||
const rows = roadtripRows(day([desk('Sixt Hbf', 'pickup'), stop('Bremen'), desk('Sixt Airport', 'return')], { legs: [seg(0), seg(1)] }))
|
||||
expect(rows.map(r => r.kind)).toEqual(['stop', 'leg', 'stop', 'leg', 'stop'])
|
||||
expect(stopRows(rows).map(r => [r.stop.name, r.number])).toEqual([['Sixt Hbf', null], ['Bremen', 1], ['Sixt Airport', null]])
|
||||
const d = day([desk('Sixt Hbf', 'pickup'), stop('Bremen'), desk('Sixt Airport', 'return')], { legs: [seg(0), seg(1)] })
|
||||
expect(legReroutable(d, 0)).toBe(false)
|
||||
expect(legReroutable(d, 1)).toBe(true)
|
||||
})
|
||||
|
||||
it('FE-RTROW-047: the road into a departure terminal can be offered other ways, nothing leaving a terminal can', () => {
|
||||
|
||||
Reference in New Issue
Block a user