Use esbuild

This commit is contained in:
Fedor Indutny 2022-02-11 13:38:52 -08:00 committed by GitHub
parent 3c1ccce9bd
commit 0174687542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 528 additions and 906 deletions

View file

@ -1,34 +1,19 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import * as sinon from 'sinon';
import { times } from 'lodash';
import * as remoteConfig from '../../RemoteConfig';
import { updateRemoteConfig } from '../helpers/RemoteConfigStub';
import { UUID } from '../../types/UUID';
import { isConversationTooBigToRing } from '../../conversations/isConversationTooBigToRing';
const CONFIG_KEY = 'global.calling.maxGroupCallRingSize';
describe('isConversationTooBigToRing', () => {
let sinonSandbox: sinon.SinonSandbox;
let getMaxGroupCallRingSizeStub: sinon.SinonStub;
beforeEach(() => {
sinonSandbox = sinon.createSandbox();
const getValueStub = sinonSandbox.stub(remoteConfig, 'getValue');
getMaxGroupCallRingSizeStub = getValueStub.withArgs(
'global.calling.maxGroupCallRingSize'
);
});
const fakeMemberships = (count: number) =>
times(count, () => ({ uuid: UUID.generate().toString(), isAdmin: false }));
afterEach(() => {
sinonSandbox.restore();
});
it('returns false if there are no memberships (i.e., for a direct conversation)', () => {
assert.isFalse(isConversationTooBigToRing({}));
assert.isFalse(isConversationTooBigToRing({ memberships: [] }));
@ -45,17 +30,20 @@ describe('isConversationTooBigToRing', () => {
}
};
it('returns whether there are 16 or more people in the group, if there is nothing in remote config', () => {
it('returns whether there are 16 or more people in the group, if there is nothing in remote config', async () => {
await updateRemoteConfig([]);
textMaximum(16);
});
it('returns whether there are 16 or more people in the group, if the remote config value is bogus', () => {
getMaxGroupCallRingSizeStub.returns('uh oh');
it('returns whether there are 16 or more people in the group, if the remote config value is bogus', async () => {
await updateRemoteConfig([
{ name: CONFIG_KEY, value: 'uh oh', enabled: true },
]);
textMaximum(16);
});
it('returns whether there are 9 or more people in the group, if the remote config value is 9', () => {
getMaxGroupCallRingSizeStub.returns('9');
it('returns whether there are 9 or more people in the group, if the remote config value is 9', async () => {
await updateRemoteConfig([{ name: CONFIG_KEY, value: '9', enabled: true }]);
textMaximum(9);
});
});