Calls Tab & Group Call Disposition
This commit is contained in:
parent
620e85ca01
commit
1eaabb6734
139 changed files with 9182 additions and 2721 deletions
|
@ -2,11 +2,23 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { getCallingNotificationText } from '../../util/callingNotification';
|
||||
import {
|
||||
CallExternalState,
|
||||
getCallingNotificationText,
|
||||
} from '../../util/callingNotification';
|
||||
import { CallMode } from '../../types/Calling';
|
||||
import { setupI18n } from '../../util/setupI18n';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import { getDefaultConversation } from '../helpers/getDefaultConversation';
|
||||
import {
|
||||
getDefaultConversation,
|
||||
getDefaultGroup,
|
||||
} from '../helpers/getDefaultConversation';
|
||||
import {
|
||||
CallDirection,
|
||||
CallType,
|
||||
GroupCallStatus,
|
||||
} from '../../types/CallDisposition';
|
||||
import { getPeerIdFromConversation } from '../../util/callDisposition';
|
||||
|
||||
describe('calling notification helpers', () => {
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
@ -15,15 +27,24 @@ describe('calling notification helpers', () => {
|
|||
// Direct call behavior is not tested here.
|
||||
|
||||
it('says that the call has ended', () => {
|
||||
const callCreator = getDefaultConversation();
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
ended: true,
|
||||
callHistory: {
|
||||
callId: '123',
|
||||
peerId: getPeerIdFromConversation(getDefaultGroup()),
|
||||
ringerId: callCreator.uuid ?? null,
|
||||
mode: CallMode.Group,
|
||||
type: CallType.Group,
|
||||
direction: CallDirection.Incoming,
|
||||
timestamp: Date.now(),
|
||||
status: GroupCallStatus.Missed,
|
||||
},
|
||||
callCreator,
|
||||
callExternalState: CallExternalState.Ended,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
startedTime: Date.now(),
|
||||
},
|
||||
i18n
|
||||
),
|
||||
|
@ -32,19 +53,26 @@ describe('calling notification helpers', () => {
|
|||
});
|
||||
|
||||
it("includes the creator's first name when describing a call", () => {
|
||||
const conversation = getDefaultConversation({
|
||||
const callCreator = getDefaultConversation({
|
||||
systemGivenName: 'Luigi',
|
||||
});
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
creator: conversation,
|
||||
ended: false,
|
||||
callHistory: {
|
||||
callId: '123',
|
||||
peerId: getPeerIdFromConversation(getDefaultGroup()),
|
||||
ringerId: callCreator.uuid ?? null,
|
||||
mode: CallMode.Group,
|
||||
type: CallType.Group,
|
||||
direction: CallDirection.Incoming,
|
||||
timestamp: Date.now(),
|
||||
status: GroupCallStatus.Ringing,
|
||||
},
|
||||
callCreator,
|
||||
callExternalState: CallExternalState.Active,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
startedTime: Date.now(),
|
||||
},
|
||||
i18n
|
||||
),
|
||||
|
@ -53,20 +81,27 @@ describe('calling notification helpers', () => {
|
|||
});
|
||||
|
||||
it("if the creator doesn't have a first name, falls back to their title", () => {
|
||||
const conversation = getDefaultConversation({
|
||||
const callCreator = getDefaultConversation({
|
||||
systemGivenName: undefined,
|
||||
title: 'Luigi Mario',
|
||||
});
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
creator: conversation,
|
||||
ended: false,
|
||||
callHistory: {
|
||||
callId: '123',
|
||||
peerId: getPeerIdFromConversation(getDefaultGroup()),
|
||||
ringerId: callCreator.uuid ?? null,
|
||||
mode: CallMode.Group,
|
||||
type: CallType.Group,
|
||||
direction: CallDirection.Incoming,
|
||||
timestamp: Date.now(),
|
||||
status: GroupCallStatus.Ringing,
|
||||
},
|
||||
callCreator,
|
||||
callExternalState: CallExternalState.Active,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
startedTime: Date.now(),
|
||||
},
|
||||
i18n
|
||||
),
|
||||
|
@ -75,19 +110,26 @@ describe('calling notification helpers', () => {
|
|||
});
|
||||
|
||||
it('has a special message if you were the one to start the call', () => {
|
||||
const conversation = getDefaultConversation({
|
||||
const callCreator = getDefaultConversation({
|
||||
isMe: true,
|
||||
});
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
creator: conversation,
|
||||
ended: false,
|
||||
callHistory: {
|
||||
callId: '123',
|
||||
peerId: getPeerIdFromConversation(getDefaultGroup()),
|
||||
ringerId: callCreator.uuid ?? null,
|
||||
mode: CallMode.Group,
|
||||
type: CallType.Group,
|
||||
direction: CallDirection.Outgoing,
|
||||
timestamp: Date.now(),
|
||||
status: GroupCallStatus.Ringing,
|
||||
},
|
||||
callCreator,
|
||||
callExternalState: CallExternalState.Active,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
startedTime: Date.now(),
|
||||
},
|
||||
i18n
|
||||
),
|
||||
|
@ -99,12 +141,20 @@ describe('calling notification helpers', () => {
|
|||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
ended: false,
|
||||
callHistory: {
|
||||
callId: '123',
|
||||
peerId: getPeerIdFromConversation(getDefaultGroup()),
|
||||
ringerId: null,
|
||||
mode: CallMode.Group,
|
||||
type: CallType.Group,
|
||||
direction: CallDirection.Outgoing,
|
||||
timestamp: Date.now(),
|
||||
status: GroupCallStatus.Ringing,
|
||||
},
|
||||
callCreator: null,
|
||||
callExternalState: CallExternalState.Active,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
startedTime: Date.now(),
|
||||
},
|
||||
i18n
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue