You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Revert "Add the call object to Call events"
This commit is contained in:
@@ -431,33 +431,6 @@ describe("Call", function () {
|
||||
expect(transceivers.get("m.usermedia:video")!.sender.track!.id).toBe("usermedia_video_track");
|
||||
});
|
||||
|
||||
it("should handle error on call upgrade", async () => {
|
||||
const onError = jest.fn();
|
||||
call.on(CallEvent.Error, onError);
|
||||
|
||||
await startVoiceCall(client, call);
|
||||
|
||||
await call.onAnswerReceived(
|
||||
makeMockEvent("@test:foo", {
|
||||
version: 1,
|
||||
call_id: call.callId,
|
||||
party_id: "party_id",
|
||||
answer: {
|
||||
sdp: DUMMY_SDP,
|
||||
},
|
||||
[SDPStreamMetadataKey]: {},
|
||||
}),
|
||||
);
|
||||
|
||||
const mockGetUserMediaStream = jest.fn().mockRejectedValue(new Error("Test error"));
|
||||
client.client.getMediaHandler().getUserMediaStream = mockGetUserMediaStream;
|
||||
|
||||
// then unmute which should cause an upgrade
|
||||
await call.setLocalVideoMuted(false);
|
||||
|
||||
expect(onError).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should unmute video after upgrading to video call", async () => {
|
||||
// Regression test for https://github.com/vector-im/element-call/issues/925
|
||||
await startVoiceCall(client, call);
|
||||
@@ -764,22 +737,11 @@ describe("Call", function () {
|
||||
|
||||
const dataChannel = call.createDataChannel("data_channel_label", { id: 123 });
|
||||
|
||||
expect(dataChannelCallback).toHaveBeenCalledWith(dataChannel, call);
|
||||
expect(dataChannelCallback).toHaveBeenCalledWith(dataChannel);
|
||||
expect(dataChannel.label).toBe("data_channel_label");
|
||||
expect(dataChannel.id).toBe(123);
|
||||
});
|
||||
|
||||
it("should emit a data channel event when the other side adds a data channel", async () => {
|
||||
await startVoiceCall(client, call);
|
||||
|
||||
const dataChannelCallback = jest.fn();
|
||||
call.on(CallEvent.DataChannel, dataChannelCallback);
|
||||
|
||||
(call.peerConn as unknown as MockRTCPeerConnection).triggerIncomingDataChannel();
|
||||
|
||||
expect(dataChannelCallback).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("supportsMatrixCall", () => {
|
||||
it("should return true when the environment is right", () => {
|
||||
expect(supportsMatrixCall()).toBe(true);
|
||||
@@ -1642,7 +1604,7 @@ describe("Call", function () {
|
||||
hasAdvancedBy += advanceBy;
|
||||
|
||||
expect(lengthChangedListener).toHaveBeenCalledTimes(hasAdvancedBy);
|
||||
expect(lengthChangedListener).toHaveBeenCalledWith(hasAdvancedBy, call);
|
||||
expect(lengthChangedListener).toHaveBeenCalledWith(hasAdvancedBy);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1672,24 +1634,4 @@ describe("Call", function () {
|
||||
expect(call.hangup).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Call replace", () => {
|
||||
it("Fires event when call replaced", async () => {
|
||||
const onReplace = jest.fn();
|
||||
call.on(CallEvent.Replaced, onReplace);
|
||||
|
||||
await call.placeVoiceCall();
|
||||
|
||||
const call2 = new MatrixCall({
|
||||
client: client.client,
|
||||
roomId: FAKE_ROOM_ID,
|
||||
});
|
||||
call2.on(CallEvent.Error, errorListener);
|
||||
await fakeIncomingCall(client, call2);
|
||||
|
||||
call.replacedBy(call2);
|
||||
|
||||
expect(onReplace).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user