From c1f8bdd672d7f7d509fb92e4aff89b663c03b7ce Mon Sep 17 00:00:00 2001 From: iansw246 <35947093+iansw246@users.noreply.github.com> Date: Wed, 25 Oct 2023 00:49:23 +0000 Subject: [PATCH] Add leading number and spaces tests --- test/testUtils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/testUtils.ts b/test/testUtils.ts index 89bd5c19..59e586c6 100644 --- a/test/testUtils.ts +++ b/test/testUtils.ts @@ -16,10 +16,11 @@ export function run() { t.is(generateName('ABcd', usedNames), 'ABcd') t.is(generateName('$Abc_123', usedNames), '$Abc_123') t.is(generateName('Abc-de-f', usedNames), 'AbcDeF') + t.is(generateName(' 412Abc-de-f', usedNames), '_412AbcDeF') // Unicode tests. See https://mathiasbynens.be/notes/javascript-identifiers-es6 to confirm results t.is(generateName('呵呵', usedNames), '呵呵') - t.is(generateName('Abc 𝄇 de-fg', usedNames), 'AbcDeFg') + t.is(generateName('abc 𝄇 de-fg', usedNames), 'AbcDeFg') t.is(generateName('Abcಠ_ಠde-fgh๏_๏', usedNames), 'Abcಠ_ಠdeFgh_') t.is(generateName('ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ', usedNames), 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ') t.is(generateName('ÄÖÉÜß', usedNames), 'ÄÖÉÜß') @@ -29,7 +30,7 @@ export function run() { // Emoji flags use two regional indicator symbols t.is(generateName('🇳🇵 Emoji flags 🇦🇩', usedNames), 'EmojiFlags') // Regional flags like England use emoji tag sequences - t.is(generateName('🏴󠁧󠁢󠁥󠁮󠁧󠁿 England 🏴󠁧󠁢󠁳󠁣󠁴󠁿', usedNames), 'England') + t.is(generateName(' 🏴󠁧󠁢󠁥󠁮󠁧󠁿 england 🏴󠁧󠁢󠁳󠁣󠁴󠁿', usedNames), 'England') // Index should increment: t.is(generateName('a', usedNames), 'A1')