mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-23 01:48:13 +01:00
MessageController: return all messages by sent at, not just 1
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user