42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
getPoiCategoryIconHref,
|
|
getPoiIconHref,
|
|
resolvePoiIconKey
|
|
} from '@/domain/poiCategories'
|
|
|
|
describe('shared POI icon registry', () => {
|
|
it('uses the same symbol content for map POIs and search categories', () => {
|
|
expect(resolvePoiIconKey({
|
|
primaryCategory: 'business_poi',
|
|
iconType: 'ticket_office',
|
|
name: '售票机'
|
|
})).toBe('ticket-office')
|
|
expect(getPoiIconHref('ticket-office')).toBe(getPoiCategoryIconHref('ticket-office'))
|
|
})
|
|
|
|
it.each([
|
|
['entrance', '停车场入口'],
|
|
['parking', '停车场'],
|
|
['place', '室外下沉广场'],
|
|
['road', '红花潭路'],
|
|
['transport', '大巴区']
|
|
] as const)('resolves the %s exterior icon', (expected, name) => {
|
|
expect(resolvePoiIconKey({ iconType: expected, name })).toBe(expected)
|
|
expect(getPoiIconHref(expected)).toContain(`#poi-${expected}`)
|
|
})
|
|
|
|
it('falls back to a neutral POI symbol instead of borrowing a wrong category icon', () => {
|
|
expect(resolvePoiIconKey({ primaryCategory: 'unknown', name: '未知地点' })).toBe('poi')
|
|
expect(getPoiIconHref('poi')).toContain('#poi-generic')
|
|
})
|
|
|
|
it.each(['stairs', 'stair', '楼梯'])('resolves %s to the shared stairs symbol', (iconType) => {
|
|
expect(resolvePoiIconKey({
|
|
primaryCategory: 'transport_circulation',
|
|
iconType
|
|
})).toBe('stairs')
|
|
expect(getPoiIconHref('stairs')).toContain('#poi-stairs')
|
|
})
|
|
})
|