mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-26 03:18:17 +01:00
Initial Poll message receive support
This commit is contained in:
@@ -3,7 +3,12 @@
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import { getGraphemes, count, isSingleGrapheme } from '../../util/grapheme.js';
|
||||
import {
|
||||
getGraphemes,
|
||||
count,
|
||||
hasAtMostGraphemes,
|
||||
isSingleGrapheme,
|
||||
} from '../../util/grapheme.js';
|
||||
|
||||
describe('grapheme utilities', () => {
|
||||
describe('getGraphemes', () => {
|
||||
@@ -79,4 +84,21 @@ describe('grapheme utilities', () => {
|
||||
assert.isFalse(isSingleGrapheme('😍a'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasAtMostGraphemes', () => {
|
||||
it('returns true when the string is within the limit', () => {
|
||||
assert.isTrue(hasAtMostGraphemes('', 0));
|
||||
assert.isTrue(hasAtMostGraphemes('👩❤️👩', 1));
|
||||
assert.isTrue(hasAtMostGraphemes('👌🏽👌🏾👌🏿', 3));
|
||||
});
|
||||
|
||||
it('returns false when the string exceeds the limit', () => {
|
||||
assert.isFalse(hasAtMostGraphemes('👌🏽👌🏾👌🏿', 2));
|
||||
assert.isFalse(hasAtMostGraphemes('abc', 2));
|
||||
});
|
||||
|
||||
it('returns false for negative limits', () => {
|
||||
assert.isFalse(hasAtMostGraphemes('anything', -1));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user