fix(planner): hold the tests and the road trip rule to the corrected morning stay

The road trip spec and wiki described the old choice of the stay a day wakes up in,
and three tests still looked for the Tour label.
This commit is contained in:
Maurice
2026-11-04 14:00:35 +01:00
parent 3c78452c14
commit 82295a1d3f
5 changed files with 8 additions and 7 deletions
@@ -169,7 +169,7 @@ describe('buildDayRouteRuns', () => {
expect(hotelBookendOf(run[0], run[1])).toBe('morning')
})
it('FE-MAP-DRP-017: the morning after a night away starts at the side trip's hotel, not the room kept at home', () => {
it("FE-MAP-DRP-017: the morning after a night away starts at the side trip's hotel, not the room kept at home", () => {
// The first hotel stays booked over the whole trip and comes first in the list; the
// side trip's hotel holds the night before. The day used to start with a 716 km drive
// from the kept room to the side trip's first stop.
@@ -133,7 +133,7 @@ describe('ReservationModal', () => {
expect(screen.getByRole('button', { name: /^Accommodation$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Restaurant$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Event$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Tour$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Guided tour$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Parking$/i })).toBeInTheDocument();
// The pill reads "Booking Type: Other", so only its option is named plain "Other".
expect(screen.getAllByRole('button', { name: /^Other$/i })).toHaveLength(1);
@@ -708,7 +708,7 @@ describe('ReservationModal', () => {
it('FE-PLANNER-RESMODAL-045: tour type shows time pickers', async () => {
render(<ReservationModal {...defaultProps} />);
await pickType(/^Tour$/i);
await pickType(/^Guided tour$/i);
await waitFor(() => {
expect(screen.getAllByTestId('time-picker').length).toBeGreaterThan(0);
});
@@ -121,7 +121,7 @@ describe('BookingsTimeline: trip view', () => {
expect(screen.getByText('No date')).toBeInTheDocument();
const metro = screen.getByRole('button', { name: /Metro ride/ });
expect(metro).toHaveAttribute('aria-pressed', 'true');
expect(screen.getByRole('button', { name: /Bonus tour/ })).toHaveTextContent('Tour, Pending');
expect(screen.getByRole('button', { name: /Bonus tour/ })).toHaveTextContent('Guided tour, Pending');
expect(screen.getByRole('button', { name: /Farewell dinner/ })).toHaveTextContent('Restaurant, Confirmed');
await userEvent.click(screen.getByRole('button', { name: /Farewell dinner/ }));
expect(onSelect).toHaveBeenCalledWith(early);
+3 -2
View File
@@ -305,13 +305,14 @@ describe('two stays on one day', () => {
expect(day!.stops[2]!.bookend?.accommodationId).toBe(3);
});
it('ROADTRIP-BOOKENDS-018: overlapping stays follow the day plan: woken up in the older, tonight in the one checked into', () => {
it('ROADTRIP-BOOKENDS-018: overlapping stays follow the day plan: woken up in the one checked into last, tonight in the one that runs on', () => {
const long = stay(1, D1, D4, HOTEL);
const short = stay(2, D2, D3, WALLINGA);
const plan = [planDay(D2, [visit(D2, 0, { name: 'P' })]), planDay(D3, [visit(D3, 0, { name: 'Q' })])];
const seated = seatNightBookends(plan, days, [long, short]);
expect(shape(seated[0])).toEqual(['morning:1', 'P', 'evening:2']);
expect(shape(seated[1])).toEqual(['morning:1', 'Q', 'evening:1']);
// The night before was spent in the short stay; the long one is where the day ends.
expect(shape(seated[1])).toEqual(['morning:2', 'Q', 'evening:1']);
});
it('ROADTRIP-BOOKENDS-019: the order the stays come in changes nothing', () => {
+1 -1
View File
@@ -308,7 +308,7 @@ With it on:
- The hotel stands at the edge of the day card as a row of its own, with a bed icon and no number. In the morning it reads *Check-out · Hotel Adler* with *until 10:00* on the day you leave, and *From Hotel Adler* on a day you come back to. When the plan sets out after the check-out hour, the row adds *Leaves after check-out*. In the evening it reads *Check-in · Hotel Adler* on the day the stay begins, and *Back to Hotel Adler* on a day you come back to, or when you placed the hotel on the day yourself earlier on.
- The drive to and from the hotel counts towards the day's distance, driving time, driving limits and range. The hotel does not count as a stop and does not refill the tank.
- These rows are not stops you planned, and nothing is stored for them: they cannot be dragged, removed or given a stay. Clicking one opens the night's booking, or the hotel's place when there is no booking to open. On the phone, a night without a booking opens the stay for somebody who may edit days.
- Only real nights count: a stay that checks in and out on the same day adds no row, and neither does a hotel without coordinates. Where two stays overlap, the choice is the one **Days** makes: the day ends at a stay checked in that day, otherwise at the one it started from, and it starts at a stay checked in on an earlier day, the one entered first where there are two. A drive between two different hotels is then a real drive.
- Only real nights count: a stay that checks in and out on the same day adds no row, and neither does a hotel without coordinates. Where two stays overlap, the choice is the one **Days** makes: the day ends at a stay checked in that day, otherwise at one that runs on past that day, and it starts at the stay checked into last before that day, the one entered first where two were checked into on the same day. A drive between two different hotels is then a real drive.
- The stop a booking put on its check-in day gives way to that evening's row, the way **Days** hides it: the day checks out, drives its places and ends at tonight's hotel, instead of visiting the hotel in the middle of the day and coming back to it at night. It stays while it is already the day's last stop, or when the day ends at a departure terminal instead. A hotel you placed on the day yourself always stays.
- A side of the day that already starts or ends at the hotel gets no row. Neither does a day that starts where a flight, train or ferry lands or at a hire car's pick-up desk, or ends at a departure terminal or where the hire car goes back.
- A day with one place becomes a drive from the hotel to it and back. A day between two nights in the same hotel with no place planned has no drive, and a check-out day with no places is the drive from one hotel to the next.