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

Convert call test to TypeScript

Typescript tests basically just appear to work, apart from needing
the jest types imported so the typescript checker knows what's what.

DConvert the webrtc test to typescript, which actually mostly just
serves to point out that we're not mocking the whole of `document`,
but oh well.
This commit is contained in:
David Baker
2020-10-16 18:20:03 +01:00
parent 9590c8aaf0
commit d965648fd7
3 changed files with 82 additions and 3 deletions

View File

@ -58,10 +58,13 @@ const DUMMY_SDP = (
);
class MockRTCPeerConnection {
localDescription: RTCSessionDescription;
constructor() {
this.localDescription = {
sdp: DUMMY_SDP,
type: '',
type: 'offer',
toJSON: function() {},
};
}
@ -91,6 +94,7 @@ describe('Call', function() {
global.navigator = {
mediaDevices: {
// @ts-ignore Mock
getUserMedia: () => {
return {
getTracks: () => [],
@ -102,14 +106,18 @@ describe('Call', function() {
};
global.window = {
// @ts-ignore Mock
RTCPeerConnection: MockRTCPeerConnection,
// @ts-ignore Mock
RTCSessionDescription: {},
// @ts-ignore Mock
RTCIceCandidate: {},
getUserMedia: {},
};
// @ts-ignore Mock
global.document = {};
client = new TestClient();
client = new TestClient("@alice:foo", "somedevice", "token", undefined, {});
call = new MatrixCall({
client: client.client,
roomId: '!foo:bar',