Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
cometkim committed Nov 24, 2024
1 parent 4be13d8 commit 4032ea5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ countGrapheme('a̐éö̲');
> [!NOTE]
> `countGrapheme()` is a small wrapper around `graphemeSegments()`.
>
> If you call it more than once at a time, consider memoization or use `graphemeSegments()` or `splitSegments()` once instead.
> If you need it more than once at a time, consider memoization or use `graphemeSegments()` or `splitSegments()` once instead.
#### Example: Build an advanced grapheme matcher

Expand Down
16 changes: 8 additions & 8 deletions test/grapheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,53 +108,53 @@ test('countGrapheme', async t => {
test('splitGrapheme', async t => {
await t.test('latin', () => {
assert.deepEqual(
splitGraphemes('abcd'),
[...splitGraphemes('abcd')],
['a', 'b', 'c', 'd'],
);
});

await t.test('flags', () => {
assert.deepEqual(
splitGraphemes('🇷🇸🇮🇴'),
[...splitGraphemes('🇷🇸🇮🇴')],
['🇷🇸', '🇮🇴'],
);
});

await t.test('emoji', () => {
assert.deepEqual(
splitGraphemes('👻👩‍👩‍👦‍👦'),
[...splitGraphemes('👻👩‍👩‍👦‍👦')],
['👻', '👩‍👩‍👦‍👦'],
);
assert.deepEqual(
splitGraphemes('🌷🎁💩😜👍🏳️‍🌈'),
[...splitGraphemes('🌷🎁💩😜👍🏳️‍🌈')],
['🌷', '🎁', '💩', '😜', '👍', '🏳️‍🌈'],
);
});

await t.test('diacritics as combining marks', () => {
assert.deepEqual(
splitGraphemes('Ĺo͂řȩm̅'),
[...splitGraphemes('Ĺo͂řȩm̅')],
['Ĺ', 'o͂', 'ř', 'ȩ', 'm̅'],
);
});

await t.test('Jamo', () => {
assert.deepEqual(
splitGraphemes('가갉'),
[...splitGraphemes('가갉')],
['가', '갉'],
);
});

await t.test('Hindi', () => {
assert.deepEqual(
splitGraphemes('अनुच्छेद'),
[...splitGraphemes('अनुच्छेद')],
['अ', 'नु', 'च्छे', 'द'],
);
});

await t.test('demonic', () => {
assert.deepEqual(
splitGraphemes('Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞'),
[...splitGraphemes('Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞')],
['Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍', 'A̴̵̜̰͔ͫ͗͢', 'L̠ͨͧͩ͘', 'G̴̻͈͍͔̹̑͗̎̅͛́', 'Ǫ̵̹̻̝̳͂̌̌͘', '!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞'],
);
});
Expand Down

0 comments on commit 4032ea5

Please sign in to comment.