import {describe, expect, test} from 'bun:test'

import {pickTagEmoji} from './emojis'

describe('pickTagEmoji', () => {
  test('matches known tag names', () => {
    expect(pickTagEmoji('pizza')).toBe('🍕')
    expect(pickTagEmoji('coffee')).toBe('☕')
    expect(pickTagEmoji('museum')).toBe('🖼️')
  })

  test('matches plurals', () => {
    expect(pickTagEmoji('tacos')).toBe('🌮')
    expect(pickTagEmoji('beaches')).toBe('🏖️')
  })

  test('matches parts of dashed tags', () => {
    expect(pickTagEmoji('coffee-shop')).toBe('☕')
    expect(pickTagEmoji('natural-wine')).toBe('🍷')
  })

  test('falls back to the default pin', () => {
    expect(pickTagEmoji('zzzz-unknown')).toBe('📍')
    expect(pickTagEmoji('')).toBe('📍')
  })

  test('is case and whitespace tolerant', () => {
    expect(pickTagEmoji(' Pizza ')).toBe('🍕')
  })
})
