The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
import { describe, expect, it } from 'vitest'
import { stayPlaces } from './stayPlaces'
// FE-UTIL-STAYPLACES-001 to FE-UTIL-STAYPLACES-004
describe('stayPlaces', () => {
const hotel = { id: 1, route_geometry: null }
const hut = { id: 2 }
const track = { id: 3, route_geometry: '[[50.1,7.6],[50.2,7.7]]' }
it('FE-UTIL-STAYPLACES-001: offers every place but an imported track', () => {
expect(stayPlaces([hotel, hut, track]).map(p => p.id)).toEqual([1, 2])
expect(stayPlaces([hotel, hut, track], '').map(p => p.id)).toEqual([1, 2])
expect(stayPlaces([hotel, hut, track], null).map(p => p.id)).toEqual([1, 2])
})
it('FE-UTIL-STAYPLACES-002: keeps the track a stay already names, by number or by text', () => {
expect(stayPlaces([hotel, track], 3).map(p => p.id)).toEqual([1, 3])
expect(stayPlaces([hotel, track], '3').map(p => p.id)).toEqual([1, 3])
})
it('FE-UTIL-STAYPLACES-003: a stay at an ordinary place lets no track in', () => {
expect(stayPlaces([hotel, track], 1).map(p => p.id)).toEqual([1])
})
it('FE-UTIL-STAYPLACES-004: a city walk still waiting for its line is a tour, not somewhere to stay', () => {
const walk = { id: 4, route_geometry: null, tour_place_id: 4 }
const inn = { id: 5, route_geometry: null, tour_place_id: null }
expect(stayPlaces([hotel, walk, inn]).map(p => p.id)).toEqual([1, 5])
expect(stayPlaces([hotel, walk], 4).map(p => p.id)).toEqual([1, 4])
})
})