Improvements to group calling video requests

This commit is contained in:
Evan Hahn 2022-05-23 17:16:13 +00:00 committed by GitHub
parent 5c72c785a0
commit 3f0ed541f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 95 additions and 32 deletions

View file

@ -12,6 +12,7 @@ import {
groupBy,
isEmpty,
isIterable,
join,
map,
reduce,
repeat,
@ -320,6 +321,31 @@ describe('iterable utilities', () => {
});
});
describe('join', () => {
it('returns the empty string for empty iterables', () => {
assert.isEmpty(join([], 'x'));
assert.isEmpty(join(new Set(), 'x'));
});
it("returns the stringified value if it's the only value", () => {
assert.strictEqual(join(new Set(['foo']), 'x'), 'foo');
assert.strictEqual(join(new Set([123]), 'x'), '123');
assert.strictEqual(join([{ toString: () => 'foo' }], 'x'), 'foo');
});
it('returns each value stringified, joined by separator', () => {
assert.strictEqual(
join(new Set(['foo', 'bar', 'baz']), ' '),
'foo bar baz'
);
assert.strictEqual(join(new Set([1, 2, 3]), '--'), '1--2--3');
});
it('handles undefined and null like Array.prototype.join', () => {
assert.strictEqual(join(new Set([undefined, null]), ','), ',');
});
});
describe('map', () => {
it('returns an empty iterable when passed an empty iterable', () => {
const fn = sinon.fake();