Skip to content

Commit 44cf0aa

Browse files
committed
lint and tests
1 parent d445b60 commit 44cf0aa

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

spec/unit/matrixrtc/RoomAndToDeviceTransport.spec.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ describe("RoomAndToDeviceTransport", () => {
136136
roomKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "roomKey", 0, dateNow);
137137
toDeviceKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "toDeviceKey", 0, Date.now());
138138

139-
expect(mockLogger.debug).toHaveBeenCalledWith("To Device transport is disabled, ignoring received keys");
139+
expect(mockLogger.debug).toHaveBeenCalledWith(
140+
"[RoomAndToDeviceTransport]:",
141+
"To Device transport is disabled, ignoring received keys",
142+
);
140143
// for room key transport we will never get a disabled message because its will always just turn on
141144
expect(onTransportEnabled).toHaveBeenNthCalledWith(1, { toDevice: false, room: false });
142145
expect(onTransportEnabled).toHaveBeenNthCalledWith(2, { toDevice: false, room: true });

spec/unit/matrixrtc/RoomKeyTransport.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ describe("RoomKeyTransport", () => {
5151
room = makeMockRoom([membershipTemplate]);
5252
client = new MatrixClient({ baseUrl: "base_url" });
5353
client.matrixRTC.start();
54-
transport = new RoomKeyTransport(room, client, statistics, {
55-
getChild: jest.fn().mockReturnValue(mockLogger),
56-
} as unknown as Mocked<Logger>);
54+
transport = new RoomKeyTransport(room, client, statistics, mockLogger);
5755
transport.on(KeyTransportEvents.ReceivedKeys, (...p) => {
5856
onCallEncryptionMock(...p);
5957
});

spec/unit/matrixrtc/ToDeviceKeyTransport.spec.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ describe("ToDeviceKeyTransport", () => {
5151
},
5252
};
5353

54-
transport = new ToDeviceKeyTransport("@alice:example.org", "MYDEVICE", roomId, mockClient, statistics, {
55-
getChild: jest.fn().mockReturnValue(mockLogger),
56-
} as unknown as Mocked<Logger>);
54+
transport = new ToDeviceKeyTransport(
55+
"@alice:example.org",
56+
"MYDEVICE",
57+
roomId,
58+
mockClient,
59+
statistics,
60+
mockLogger,
61+
);
5762
});
5863

5964
it("should send my keys on via to device", async () => {
@@ -186,7 +191,7 @@ describe("ToDeviceKeyTransport", () => {
186191
}),
187192
);
188193

189-
expect(mockLogger.warn).toHaveBeenCalledWith("Malformed Event: Mismatch roomId");
194+
expect(mockLogger.warn).toHaveBeenCalledWith("[ToDeviceKeyTransport]:", "Malformed Event: Mismatch roomId");
190195
expect(statistics.counters.roomEventEncryptionKeysReceived).toBe(0);
191196
});
192197

src/matrixrtc/NewMembershipManager.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,7 @@ export class MembershipManager
296296
// we put this at the beginning of the actions scheduler loop handle callback since it is a loop this
297297
// is equivalent to running it at the end of the loop. (just after applying the status/action list changes)
298298
// This order is required because this method needs to return the action updates.
299-
this.logger.debug(
300-
`applied action changes. Status: ${this.oldStatus} -> ${this.status}`,
301-
);
299+
this.logger.debug(`applied action changes. Status: ${this.oldStatus} -> ${this.status}`);
302300
if (this.oldStatus !== this.status) {
303301
this.emit(MembershipManagerEvent.StatusChanged, this.oldStatus, this.status);
304302
}

0 commit comments

Comments
 (0)