From dd89aab516ab8454c0d84eb56e165384e2e07890 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Tue, 7 Feb 2023 20:19:06 +0100 Subject: [PATCH] fix typescript error in unit test --- src/logging/NullLogger.ts | 8 ++++---- src/matrix/calls/group/Member.ts | 13 ++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/logging/NullLogger.ts b/src/logging/NullLogger.ts index bf7b3f40..83e5fc00 100644 --- a/src/logging/NullLogger.ts +++ b/src/logging/NullLogger.ts @@ -21,7 +21,7 @@ function noop (): void {} export class NullLogger implements ILogger { public readonly item: ILogItem = new NullLogItem(this); - log(): ILogItem { + log(labelOrValues: LabelOrValues): ILogItem { return this.item; } @@ -37,7 +37,7 @@ export class NullLogger implements ILogger { forceFinish(): void {} - child(): ILogItem { + child(labelOrValues: LabelOrValues): ILogItem { return this.item; } @@ -83,11 +83,11 @@ export class NullLogItem implements ILogItem { } - log(): ILogItem { + log(labelOrValues: LabelOrValues): ILogItem { return this; } - set(): ILogItem { return this; } + set(labelOrValues: LabelOrValues): ILogItem { return this; } runDetached(_: LabelOrValues, callback: LogCallback): ILogItem { new Promise(r => r(callback(this))).then(noop, noop); diff --git a/src/matrix/calls/group/Member.ts b/src/matrix/calls/group/Member.ts index daada4af..0a0e697c 100644 --- a/src/matrix/calls/group/Member.ts +++ b/src/matrix/calls/group/Member.ts @@ -511,7 +511,8 @@ export function tests() { feeds: [{purpose: "m.usermedia"}] }; const roomMember = RoomMember.fromUserId("!abc", "@bruno4:matrix.org", "join"); - const turnServer = new ObservableValue({}); + const turnServer = new ObservableValue({}) as ObservableValue; + // @ts-ignore const options = { confId: "conf", ownUserId: "@foobaraccount2:matrix.org", @@ -529,7 +530,8 @@ export function tests() { const member = new Member(roomMember, callDeviceMembership, options, logger.child("member")); member.connect(new MockMedia() as LocalMedia, new MuteSettings(), turnServer, logger.child("connect")); // pretend we've already received 3 messages - member.connection.lastProcessedSeqNr = 2; + // @ts-ignore + member.connection!.lastProcessedSeqNr = 2; // send hangup with seq=3, this will enqueue the message because there is no peerCall // as it's up to @bruno4:matrix.org to send the invite const hangup = { @@ -545,7 +547,7 @@ export function tests() { "sender_session_id": "s1d5863f41ec5a5", "dest_session_id": "s1cece7088b9d35" } - }; + } as SignallingMessage; member.handleDeviceMessage(hangup, logger.child("handle hangup")); // Send an invite with seq=4, this will create a new peer call with a the call id // when dequeueing the hangup from before, it'll get ignored because it is @@ -574,9 +576,10 @@ export function tests() { "sender_session_id": "s1d5863f41ec5a5", "dest_session_id": "s1cece7088b9d35" } - }; + } as SignallingMessage; member.handleDeviceMessage(invite, logger.child("handle invite")); - assert.equal(member.connection.queuedSignallingMessages.length, 0); + // @ts-ignore + assert.equal(member.connection!.queuedSignallingMessages.length, 0); // logger.reporters[0].printOpenItems(); } };