Initial group calling support
This commit is contained in:
parent
e398520db0
commit
022c4bd0f4
31 changed files with 2530 additions and 414 deletions
|
@ -2,19 +2,16 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { CallState } from '../../../types/Calling';
|
||||
import {
|
||||
getIncomingCall,
|
||||
getActiveCall,
|
||||
isCallActive,
|
||||
} from '../../../state/selectors/calling';
|
||||
import { getEmptyState } from '../../../state/ducks/calling';
|
||||
import { CallMode, CallState } from '../../../types/Calling';
|
||||
import { getIncomingCall } from '../../../state/selectors/calling';
|
||||
import { getEmptyState, CallingStateType } from '../../../state/ducks/calling';
|
||||
|
||||
describe('state/selectors/calling', () => {
|
||||
const stateWithDirectCall = {
|
||||
const stateWithDirectCall: CallingStateType = {
|
||||
...getEmptyState(),
|
||||
callsByConversation: {
|
||||
'fake-direct-call-conversation-id': {
|
||||
callMode: CallMode.Direct,
|
||||
conversationId: 'fake-direct-call-conversation-id',
|
||||
callState: CallState.Accepted,
|
||||
isIncoming: false,
|
||||
|
@ -24,7 +21,7 @@ describe('state/selectors/calling', () => {
|
|||
},
|
||||
};
|
||||
|
||||
const stateWithActiveDirectCall = {
|
||||
const stateWithActiveDirectCall: CallingStateType = {
|
||||
...stateWithDirectCall,
|
||||
activeCallState: {
|
||||
conversationId: 'fake-direct-call-conversation-id',
|
||||
|
@ -36,10 +33,11 @@ describe('state/selectors/calling', () => {
|
|||
},
|
||||
};
|
||||
|
||||
const stateWithIncomingDirectCall = {
|
||||
const stateWithIncomingDirectCall: CallingStateType = {
|
||||
...getEmptyState(),
|
||||
callsByConversation: {
|
||||
'fake-direct-call-conversation-id': {
|
||||
callMode: CallMode.Direct,
|
||||
conversationId: 'fake-direct-call-conversation-id',
|
||||
callState: CallState.Ringing,
|
||||
isIncoming: true,
|
||||
|
@ -61,6 +59,7 @@ describe('state/selectors/calling', () => {
|
|||
|
||||
it('returns the incoming call', () => {
|
||||
assert.deepEqual(getIncomingCall(stateWithIncomingDirectCall), {
|
||||
callMode: CallMode.Direct,
|
||||
conversationId: 'fake-direct-call-conversation-id',
|
||||
callState: CallState.Ringing,
|
||||
isIncoming: true,
|
||||
|
@ -69,38 +68,4 @@ describe('state/selectors/calling', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getActiveCall', () => {
|
||||
it('returns undefined if there are no calls', () => {
|
||||
assert.isUndefined(getActiveCall(getEmptyState()));
|
||||
});
|
||||
|
||||
it('returns undefined if there is no active call', () => {
|
||||
assert.isUndefined(getActiveCall(stateWithDirectCall));
|
||||
});
|
||||
|
||||
it('returns the active call', () => {
|
||||
assert.deepEqual(getActiveCall(stateWithActiveDirectCall), {
|
||||
conversationId: 'fake-direct-call-conversation-id',
|
||||
callState: CallState.Accepted,
|
||||
isIncoming: false,
|
||||
isVideoCall: false,
|
||||
hasRemoteVideo: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('isCallActive', () => {
|
||||
it('returns false if there are no calls', () => {
|
||||
assert.isFalse(isCallActive(getEmptyState()));
|
||||
});
|
||||
|
||||
it('returns false if there is no active call', () => {
|
||||
assert.isFalse(isCallActive(stateWithDirectCall));
|
||||
});
|
||||
|
||||
it('returns true if there is an active call', () => {
|
||||
assert.isTrue(isCallActive(stateWithActiveDirectCall));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue