import { describe, it, expect } from 'vitest'
import { profileIcon } from '@/utils/profileIcons.js'
// The profiles that ship with Navi. The grid shows them side by side, so what
// matters is that no two of them look alike — six of these used to be the same
// robot, because the mapping only knew four ids.
const SHIPPED = [
'assistant',
'coder',
'designer_3d',
'modeler_3d',
'navi_code',
'dispatcher',
'secretary',
'developer',
'discuss',
'server_admin',
]
describe('profileIcon', () => {
it('gives every shipped profile its own icon', () => {
const icons = SHIPPED.map((id) => profileIcon({ id }))
expect(new Set(icons).size).toBe(SHIPPED.length)
for (const icon of icons) expect(icon).toMatch(/^ph ph-[a-z-]+$/)
})
it('does not put two profiles of the same subject on one glyph', () => {
expect(profileIcon({ id: 'coder' })).not.toBe(profileIcon({ id: 'developer' }))
expect(profileIcon({ id: 'designer_3d' })).not.toBe(profileIcon({ id: 'modeler_3d' }))
})
it('keeps an unknown profile on one stable icon instead of a per-render pick', () => {
const first = profileIcon({ id: 'astronaut' })
expect(profileIcon({ id: 'astronaut' })).toBe(first)
expect(first).toMatch(/^ph ph-[a-z-]+$/)
})
it('spreads unknown profiles over more than one glyph', () => {
const ids = Array.from({ length: 24 }, (_, i) => `custom-${i}`)
const icons = new Set(ids.map((id) => profileIcon({ id })))
expect(icons.size).toBeGreaterThan(1)
})
it('falls back to the robot for a missing profile', () => {
expect(profileIcon(null)).toBe('ph ph-robot')
expect(profileIcon({})).toBe('ph ph-robot')
})
})