Improve performance of isEmojiOnlyText
This commit is contained in:
parent
8fa4cd68d5
commit
6578679166
2 changed files with 45 additions and 4 deletions
28
ts/test-both/util/isEmojiOnlyText_test.ts
Normal file
28
ts/test-both/util/isEmojiOnlyText_test.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import { isEmojiOnlyText } from '../../util/isEmojiOnlyText';
|
||||
|
||||
describe('isEmojiOnlyText', () => {
|
||||
it('returns false on empty string', () => {
|
||||
assert.isFalse(isEmojiOnlyText(''));
|
||||
});
|
||||
|
||||
it('returns false on non-emoji string', () => {
|
||||
assert.isFalse(isEmojiOnlyText('123'));
|
||||
});
|
||||
|
||||
it('returns false on mixed emoji/text string', () => {
|
||||
assert.isFalse(isEmojiOnlyText('12😎3'));
|
||||
});
|
||||
|
||||
it('returns false on mixed emoji/text string starting with emoji', () => {
|
||||
assert.isFalse(isEmojiOnlyText('😎12😎3'));
|
||||
});
|
||||
|
||||
it('returns true on all emoji string', () => {
|
||||
assert.isTrue(isEmojiOnlyText('😎👍😀😮💨'));
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue