refactor(planner): the night's hotels are read in shared

Which stay a day wakes up in and which one it sleeps in was decided in the
client's Days view only. The rule, with the day order, the stay range and the
check whether the hotel is the edge stop itself, now lives in shared under
day/stay-bookends, typed on the few fields it reads, so the road trip in the
browser and on the server can make the same choice as Days. The Days helpers
re-export it unchanged, and their tests pass untouched; nothing behaves
differently.
This commit is contained in:
Maurice
2026-09-23 13:32:53 +02:00
parent 3a67a8e279
commit 7fa0434570
5 changed files with 288 additions and 74 deletions
+15
View File
@@ -0,0 +1,15 @@
import { describe, it, expect } from 'vitest'
import {
getDayBookendHotels as sharedBookendHotels,
getDayOrder as sharedDayOrder,
isDayInAccommodationRange as sharedInRange,
} from '@trek/shared'
import { getDayBookendHotels, getDayOrder, isDayInAccommodationRange } from './dayOrder'
describe('the night hotels Days reads', () => {
it('FE-UTIL-DAYORDER-001: are the rule in @trek/shared itself, not a copy of it', () => {
expect(getDayOrder).toBe(sharedDayOrder)
expect(isDayInAccommodationRange).toBe(sharedInRange)
expect(getDayBookendHotels).toBe(sharedBookendHotels)
})
})