Skip to content

Commit

Permalink
Make the tests pass again (#2316)
Browse files Browse the repository at this point in the history
3280394
made call use a bunch of methods that weren't mocked in the tests.
  • Loading branch information
dbkr committed Apr 22, 2022
1 parent edd5069 commit 998ac56
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/unit/webrtc/call.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ describe('Call', function() {
client.client.mediaHandler = new MockMediaHandler;
client.client.getMediaHandler = () => client.client.mediaHandler;
client.httpBackend.when("GET", "/voip/turnServer").respond(200, {});
client.client.getRoom = () => {
return {
getMember: () => {
return {};
},
};
};

call = new MatrixCall({
client: client.client,
roomId: '!foo:bar',
Expand Down Expand Up @@ -175,6 +183,7 @@ describe('Call', function() {
},
};
},
getSender: () => "@test:foo",
});

call.peerConn.addIceCandidate = jest.fn();
Expand All @@ -192,6 +201,7 @@ describe('Call', function() {
],
};
},
getSender: () => "@test:foo",
});
expect(call.peerConn.addIceCandidate.mock.calls.length).toBe(1);

Expand All @@ -209,6 +219,7 @@ describe('Call', function() {
],
};
},
getSender: () => "@test:foo",
});
expect(call.peerConn.addIceCandidate.mock.calls.length).toBe(1);

Expand Down Expand Up @@ -236,6 +247,7 @@ describe('Call', function() {
],
};
},
getSender: () => "@test:foo",
});

call.onRemoteIceCandidatesReceived({
Expand All @@ -252,6 +264,7 @@ describe('Call', function() {
],
};
},
getSender: () => "@test:foo",
});

expect(call.peerConn.addIceCandidate.mock.calls.length).toBe(0);
Expand All @@ -267,6 +280,7 @@ describe('Call', function() {
},
};
},
getSender: () => "@test:foo",
});

expect(call.peerConn.addIceCandidate.mock.calls.length).toBe(1);
Expand All @@ -291,6 +305,7 @@ describe('Call', function() {
},
};
},
getSender: () => "@test:foo",
});

const identChangedCallback = jest.fn();
Expand All @@ -308,6 +323,7 @@ describe('Call', function() {
},
};
},
getSender: () => "@test:foo",
});

expect(identChangedCallback).toHaveBeenCalled();
Expand Down Expand Up @@ -347,6 +363,7 @@ describe('Call', function() {
},
};
},
getSender: () => "@test:foo",
});

call.pushRemoteFeed(new MockMediaStream("remote_stream"));
Expand Down Expand Up @@ -376,6 +393,7 @@ describe('Call', function() {
},
};
},
getSender: () => "@test:foo",
});

call.setScreensharingEnabledWithoutMetadataSupport = jest.fn();
Expand Down

0 comments on commit 998ac56

Please sign in to comment.