This commit is contained in:
33
tests/unit/PoiSeriesGrouping.spec.ts
Normal file
33
tests/unit/PoiSeriesGrouping.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { resolvePoiSeriesGroup } from '@/domain/poiSeriesGrouping'
|
||||
|
||||
const ticketMachine = (floorId: string, name: string) => resolvePoiSeriesGroup({
|
||||
floorId,
|
||||
name,
|
||||
category: 'basic_service_facility',
|
||||
iconType: 'ticket_office'
|
||||
})
|
||||
|
||||
describe('POI numbered series grouping', () => {
|
||||
it('groups the four numbered ticket machines on the same floor', () => {
|
||||
const groups = [1, 2, 3, 4].map((index) => (
|
||||
ticketMachine('L1', `L1_售票机_0${index}`)
|
||||
))
|
||||
|
||||
expect(groups.every(Boolean)).toBe(true)
|
||||
expect(new Set(groups.map((group) => group?.groupKey)).size).toBe(1)
|
||||
expect(groups[0]).toMatchObject({ displayName: '售票机' })
|
||||
})
|
||||
|
||||
it('does not group ticket locations without an explicit numbered suffix', () => {
|
||||
expect(ticketMachine('L1', '售票机')).toBeNull()
|
||||
expect(ticketMachine('L1', '展厅售票点')).toBeNull()
|
||||
})
|
||||
|
||||
it('keeps the same numbered series on different floors separate', () => {
|
||||
const l1 = ticketMachine('L1', 'L1_售票机_01')
|
||||
const l2 = ticketMachine('L2', 'L2_售票机_01')
|
||||
|
||||
expect(l1?.groupKey).not.toBe(l2?.groupKey)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user