Speaking indicator for group calls

Co-authored-by: Peter Thatcher <peter@signal.org>
Co-authored-by: Jim Gustafson <jim@signal.org>
Co-authored-by: Josh Perez <60019601+josh-signal@users.noreply.github.com>
This commit is contained in:
Evan Hahn
2022-02-08 12:30:33 -06:00
committed by GitHub
parent cb5131420f
commit 5ce26eb91a
35 changed files with 482 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
@@ -6,6 +6,7 @@ import * as sinon from 'sinon';
import {
concat,
every,
filter,
find,
groupBy,
@@ -170,6 +171,30 @@ describe('iterable utilities', () => {
});
});
describe('every', () => {
const isOdd = (n: number): boolean => Boolean(n % 2);
it('returns true for empty iterables and never checks the predicate', () => {
const fn = sinon.fake();
assert.isTrue(every([], fn));
assert.isTrue(every(new Set(), fn));
assert.isTrue(every(new Map(), fn));
sinon.assert.notCalled(fn);
});
it('returns false if any values make the predicate return false', () => {
assert.isFalse(every([2], isOdd));
assert.isFalse(every([1, 2, 3], isOdd));
});
it('returns true if all values make the predicate return true', () => {
assert.isTrue(every([1], isOdd));
assert.isTrue(every([1, 3, 5], isOdd));
});
});
describe('filter', () => {
it('returns an empty iterable when passed an empty iterable', () => {
const fn = sinon.fake();