import { describe, expect, it } from 'vitest'; import { EMOJI_PICKER_GROUPS, QUICK_REACTIONS, isSingleEmoji, searchEmoji } from './reactions'; describe('emoji', () => { it('has every group and the quick reactions in it', () => { expect(EMOJI_PICKER_GROUPS.map((g) => g.name)).toContain('Smileys and Emotion'); const all = new Set(EMOJI_PICKER_GROUPS.flatMap((g) => g.emojis.map((e) => e.emoji))); for (const q of QUICK_REACTIONS) expect(all.has(q)).toBe(true); }); it('searches by word starts', () => { expect(searchEmoji('fire').map((e) => e.emoji)).toContain('🔥'); expect(searchEmoji('red hea').map((e) => e.emoji)).toContain('❤️'); expect(searchEmoji(' ')).toEqual([]); }); it('accepts exactly one emoji', () => { for (const ok of ['🔥', '❤️', '👍🏽', '👩‍💻', '🇯🇵', '🏳️‍🌈']) expect(isSingleEmoji(ok)).toBe(true); for (const bad of ['', 'a', '🔥🔥', 'hi 🔥', '', '1']) expect(isSingleEmoji(bad)).toBe(false); }); });