Message details: group by send status, including viewed state

This commit is contained in:
Evan Hahn 2021-07-20 14:56:50 -05:00 committed by GitHub
parent d91c336e62
commit 1e10286210
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 380 additions and 248 deletions

View file

@ -0,0 +1,30 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import * as sinon from 'sinon';
import { groupBy } from '../../util/mapUtil';
describe('map utilities', () => {
describe('groupBy', () => {
it('returns an empty map when passed an empty iterable', () => {
const fn = sinon.fake();
assert.isEmpty(groupBy([], fn));
sinon.assert.notCalled(fn);
});
it('groups the iterable', () => {
assert.deepEqual(
groupBy([2.3, 1.3, 2.9, 1.1, 3.4], Math.floor),
new Map([
[1, [1.3, 1.1]],
[2, [2.3, 2.9]],
[3, [3.4]],
])
);
});
});
});