1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-31 15:24:23 +03:00

Jest: should map SDPStreamMetadata to feeds

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-05-08 15:39:11 +02:00
parent c6764490c6
commit b67cd94ee2

View File

@ -16,6 +16,7 @@ limitations under the License.
import {TestClient} from '../../TestClient';
import {MatrixCall, CallErrorCode, CallEvent} from '../../../src/webrtc/call';
import { SDPStreamMetadataKey, SDPStreamMetadataPurpose } from '../../../src/webrtc/callEventTypes';
const DUMMY_SDP = (
"v=0\r\n" +
@ -298,4 +299,33 @@ describe('Call', function() {
// Hangup to stop timers
call.hangup(CallErrorCode.UserHangup, true);
});
it("should map SDPStreamMetadata to feeds", async () => {
const callPromise = call.placeVoiceCall();
await client.httpBackend.flush();
await callPromise;
call.getOpponentMember = () => {return {userId: "@bob:bar.uk"}};
await call.onAnswerReceived({
getContent: () => {
return {
version: 1,
call_id: call.callId,
party_id: 'party_id',
answer: {
sdp: DUMMY_SDP,
},
[SDPStreamMetadataKey]: {
"stream_id": {
purpose: SDPStreamMetadataPurpose.Usermedia,
}
}
};
},
});
call.pushRemoteFeed({id: "stream_id"});
expect(call.getFeeds().find((feed) => feed.stream.id === "stream_id")?.purpose).toBe(SDPStreamMetadataPurpose.Usermedia);
});
});