From 1b31d0622e6a216b66e8cebc8ff43676c40da5bf Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Apr 2021 11:08:06 +0100 Subject: [PATCH] Unit test for asserted identity messages --- spec/unit/webrtc/call.spec.ts | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/spec/unit/webrtc/call.spec.ts b/spec/unit/webrtc/call.spec.ts index 0e7b67547..6a9d0cd52 100644 --- a/spec/unit/webrtc/call.spec.ts +++ b/spec/unit/webrtc/call.spec.ts @@ -254,4 +254,43 @@ describe('Call', function() { sdpMid: '', }); }); + + it('should map asserted identity messages to remoteAssertedIdentity', async function() { + const callPromise = call.placeVoiceCall(); + await client.httpBackend.flush(); + await callPromise; + await call.onAnswerReceived({ + getContent: () => { + return { + version: 1, + call_id: call.callId, + party_id: 'party_id', + answer: { + sdp: DUMMY_SDP, + }, + }; + }, + }); + + await call.onAssertedIdentityReceived({ + getContent: () => { + return { + version: 1, + call_id: call.callId, + party_id: 'party_id', + asserted_identity: { + id: "@steve:example.com", + display_name: "Steve Gibbons", + }, + }; + }, + }); + + const ident = call.getRemoteAssertedIdentity(); + expect(ident.id).toEqual("@steve:example.com"); + expect(ident.displayName).toEqual("Steve Gibbons"); + + // Hangup to stop timers + call.hangup(CallErrorCode.UserHangup, true); + }); });