Initial Poll message receive support

This commit is contained in:
yash-signal
2025-09-18 11:06:43 -05:00
committed by GitHub
parent 976a3135e5
commit 93ae2a4c48
15 changed files with 1072 additions and 6 deletions

View File

@@ -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));
});
});
});