import { stringHasUnicodeEmoji, stringHasUnicodeFlags } from './utils'; describe('stringHasEmoji', () => { test.concurrent.for([ ['only text', false], ['text with emoji πŸ˜€', true], ['multiple emojis πŸ˜€πŸ˜ƒπŸ˜„', true], ['emoji with skin tone πŸ‘πŸ½', true], ['emoji with ZWJ πŸ‘©β€β€οΈβ€πŸ‘¨', true], ['emoji with variation selector ✊️', true], ['emoji with keycap 1️⃣', true], ['emoji with flags πŸ‡ΊπŸ‡Έ', true], ['emoji with regional indicators πŸ‡¦πŸ‡Ί', true], ['emoji with gender πŸ‘©β€βš•οΈ', true], ['emoji with family πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦', true], ['emoji with zero width joiner πŸ‘©β€πŸ”¬', true], ['emoji with non-BMP codepoint πŸ§‘β€πŸš€', true], ['emoji with combining marks πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦', true], ['emoji with enclosing keycap #️⃣', true], ['emoji with no visible glyph \u200D', false], ] as const)( 'stringHasEmoji has emojis in "%s": %o', ([text, expected], { expect }) => { expect(stringHasUnicodeEmoji(text)).toBe(expected); }, ); }); describe('stringHasFlags', () => { test.concurrent.for([ ['EU πŸ‡ͺπŸ‡Ί', true], ['Germany πŸ‡©πŸ‡ͺ', true], ['Canada πŸ‡¨πŸ‡¦', true], ['SΓ£o TomΓ© & PrΓ­ncipe πŸ‡ΈπŸ‡Ή', true], ['Scotland 🏴󠁧󠁒󠁳󠁣󠁴󠁿', true], ['black flag 🏴', false], ['arrr πŸ΄β€β˜ οΈ', false], ['rainbow flag πŸ³οΈβ€πŸŒˆ', false], ['non-flag πŸ”₯', false], ['only text', false], ] as const)( 'stringHasFlags has flag in "%s": %o', ([text, expected], { expect }) => { expect(stringHasUnicodeFlags(text)).toBe(expected); }, ); });