MessageController: return all messages by sent at, not just 1

This commit is contained in:
Evan Hahn 2021-06-22 18:05:05 -05:00 committed by GitHub
parent baff13926b
commit 9db19283ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 128 additions and 16 deletions

View file

@ -7,6 +7,7 @@ import * as sinon from 'sinon';
import {
concat,
filter,
find,
groupBy,
isIterable,
map,
@ -211,6 +212,29 @@ describe('iterable utilities', () => {
});
});
describe('find', () => {
const isOdd = (n: number) => Boolean(n % 2);
it('returns undefined if the value is not found', () => {
assert.isUndefined(find([], isOdd));
assert.isUndefined(find([2, 4], isOdd));
});
it('returns the first matching value', () => {
assert.strictEqual(find([0, 1, 2, 3], isOdd), 1);
});
it('only iterates until a value is found', () => {
function* numbers() {
yield 2;
yield 3;
throw new Error('this should never happen');
}
find(numbers(), isOdd);
});
});
describe('groupBy', () => {
it('returns an empty object if passed an empty iterable', () => {
const fn = sinon.fake();