MessageController: return all messages by sent at, not just 1
This commit is contained in:
parent
baff13926b
commit
9db19283ac
5 changed files with 128 additions and 16 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue