mattermost-mobile/app/products/calls/utils.test.ts
Christopher Poile 0f8798ca55
MM-48611 - Calls: Calls recording host controls and UI (#6787)
* implement recording permissions and UI

* fix bug when refusing recording while in call thread from call screen

* host controls and UI for recording

* button tweak, and fixing a i18n string issue

* PR comment

* backwards compat & don't show rec controls if not enabled
2022-11-30 11:20:00 -05:00

95 lines
2.9 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import assert from 'assert';
import {CallsConfig} from '@calls/types/calls';
import {License} from '@constants';
import {getICEServersConfigs} from './utils';
describe('getICEServersConfigs', () => {
it('backwards compatible case, no ICEServersConfigs present', () => {
const config: CallsConfig = {
pluginEnabled: true,
ICEServers: ['stun:stun.example.com:3478'],
AllowEnableCalls: true,
DefaultEnabled: true,
NeedsTURNCredentials: false,
last_retrieved_at: 0,
sku_short_name: License.SKU_SHORT_NAME.Professional,
MaxCallParticipants: 8,
EnableRecordings: true,
};
const iceConfigs = getICEServersConfigs(config);
assert.deepEqual(iceConfigs, [
{
urls: ['stun:stun.example.com:3478'],
},
]);
});
it('ICEServersConfigs set', () => {
const config: CallsConfig = {
pluginEnabled: true,
ICEServersConfigs: [
{
urls: ['stun:stun.example.com:3478'],
},
{
urls: ['turn:turn.example.com:3478'],
},
],
AllowEnableCalls: true,
DefaultEnabled: true,
NeedsTURNCredentials: false,
last_retrieved_at: 0,
sku_short_name: License.SKU_SHORT_NAME.Professional,
MaxCallParticipants: 8,
EnableRecordings: true,
};
const iceConfigs = getICEServersConfigs(config);
assert.deepEqual(iceConfigs, [
{
urls: ['stun:stun.example.com:3478'],
},
{
urls: ['turn:turn.example.com:3478'],
},
]);
});
it('Both ICEServers and ICEServersConfigs set', () => {
const config: CallsConfig = {
pluginEnabled: true,
ICEServers: ['stun:stuna.example.com:3478'],
ICEServersConfigs: [
{
urls: ['stun:stunb.example.com:3478'],
},
{
urls: ['turn:turn.example.com:3478'],
},
],
AllowEnableCalls: true,
DefaultEnabled: true,
NeedsTURNCredentials: false,
last_retrieved_at: 0,
sku_short_name: License.SKU_SHORT_NAME.Professional,
MaxCallParticipants: 8,
EnableRecordings: true,
};
const iceConfigs = getICEServersConfigs(config);
assert.deepEqual(iceConfigs, [
{
urls: ['stun:stunb.example.com:3478'],
},
{
urls: ['turn:turn.example.com:3478'],
},
]);
});
});