import { describe, expect, test } from 'vitest'
import { parseEmoji } from '@/utils/emoji'

describe('function: parseEmoji', () => {
  test('传入空字符串时，返回空字符串', () => {
    const result = parseEmoji('')

    expect(result).toBe('')
  })

  test('传入不包含表情标记的文本时，返回原文本', () => {
    const result = parseEmoji('这是一段普通评论')

    expect(result).toBe('这是一段普通评论')
  })

  test('传入 YAYA 表情标记时，替换为 img 标签', () => {
    const result = parseEmoji('收到[YAYA_OK]')

    expect(result).toContain('<img')
    expect(result).toContain('alt="[YAYA_OK]"')
    expect(result).toContain('class="w-8 h-8"')
  })

  test('传入 普通 表情标记时，替换为 img 标签', () => {
    const result = parseEmoji('开心[face_哈哈]')

    expect(result).toContain('<img')
    expect(result).toContain('alt="[face_哈哈]"')
    expect(result).toContain('class="w-6 h-6"')
  })
})
