Files
TREK/client/src/utils/placeLocality.test.ts
T
Maurice 8fd46c4c18 feat: quality of life sweep from the feature discussions
Small requests from the discussions, each built end to end: planner and
map (cycling mode, date first headings, clear a day, stay times per day,
off-route stops, map lock, compact unplanned markers, pending stays,
cable car, transit quick picks), places (location filter, category from
OSM, open in maps, geo: link, image from an attachment, enrichment on
file import, places near a pin, place name language, Amap first in
China), lists and costs (packed counter, inherited sharing, Markdown
to-dos, payment notes, bookings CSV, my plan PDF), sharing (unplanned
places, travel only, without photos), journey (photo zoom, drafts,
photo order, trip suggestion, day jump), atlas (region counter, region
bucket list, places per country), vacay half company holidays, studio
copy and paste plus the book's own layouts, and RESTORE_FROM_BACKUP for
a first start restore.
2026-09-30 23:00:12 +02:00

20 lines
1.1 KiB
TypeScript

// FE-UTIL-LOCALITY-001 to FE-UTIL-LOCALITY-003
import { describe, it, expect } from 'vitest'
import { placeLocality } from './placeLocality'
describe('placeLocality', () => {
it('FE-UTIL-LOCALITY-001: a resolved place is named in the reader language with its region', () => {
expect(placeLocality({ country_code: 'DE', region_name: 'Brandenburg' }, 'de')).toEqual({ country: 'Deutschland', region: 'Brandenburg' })
expect(placeLocality({ country_code: 'fr', region_name: 'Île-de-France' }, 'en')).toEqual({ country: 'France', region: 'Île-de-France' })
})
it('FE-UTIL-LOCALITY-002: an unresolved place falls back to the country its address ends on', () => {
expect(placeLocality({ address: 'Pariser Platz, 10117 Berlin, Germany' }, 'en')).toEqual({ country: 'Germany', region: null })
expect(placeLocality({ address: 'Mildred-Harnack-Straße 11, 10243 Berlin' }, 'en')).toEqual({ country: null, region: null })
})
it('FE-UTIL-LOCALITY-003: nothing to go on gives nulls', () => {
expect(placeLocality({ address: null }, 'en')).toEqual({ country: null, region: null })
})
})