1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-06 12:02:40 +03:00

lint and tests

This commit is contained in:
Timo
2025-04-16 14:37:07 +02:00
parent d445b600f9
commit 44cf0aa93a
4 changed files with 15 additions and 11 deletions

View File

@@ -136,7 +136,10 @@ describe("RoomAndToDeviceTransport", () => {
roomKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "roomKey", 0, dateNow);
toDeviceKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "toDeviceKey", 0, Date.now());
expect(mockLogger.debug).toHaveBeenCalledWith("To Device transport is disabled, ignoring received keys");
expect(mockLogger.debug).toHaveBeenCalledWith(
"[RoomAndToDeviceTransport]:",
"To Device transport is disabled, ignoring received keys",
);
// for room key transport we will never get a disabled message because its will always just turn on
expect(onTransportEnabled).toHaveBeenNthCalledWith(1, { toDevice: false, room: false });
expect(onTransportEnabled).toHaveBeenNthCalledWith(2, { toDevice: false, room: true });

View File

@@ -51,9 +51,7 @@ describe("RoomKeyTransport", () => {
room = makeMockRoom([membershipTemplate]);
client = new MatrixClient({ baseUrl: "base_url" });
client.matrixRTC.start();
transport = new RoomKeyTransport(room, client, statistics, {
getChild: jest.fn().mockReturnValue(mockLogger),
} as unknown as Mocked<Logger>);
transport = new RoomKeyTransport(room, client, statistics, mockLogger);
transport.on(KeyTransportEvents.ReceivedKeys, (...p) => {
onCallEncryptionMock(...p);
});

View File

@@ -51,9 +51,14 @@ describe("ToDeviceKeyTransport", () => {
},
};
transport = new ToDeviceKeyTransport("@alice:example.org", "MYDEVICE", roomId, mockClient, statistics, {
getChild: jest.fn().mockReturnValue(mockLogger),
} as unknown as Mocked<Logger>);
transport = new ToDeviceKeyTransport(
"@alice:example.org",
"MYDEVICE",
roomId,
mockClient,
statistics,
mockLogger,
);
});
it("should send my keys on via to device", async () => {
@@ -186,7 +191,7 @@ describe("ToDeviceKeyTransport", () => {
}),
);
expect(mockLogger.warn).toHaveBeenCalledWith("Malformed Event: Mismatch roomId");
expect(mockLogger.warn).toHaveBeenCalledWith("[ToDeviceKeyTransport]:", "Malformed Event: Mismatch roomId");
expect(statistics.counters.roomEventEncryptionKeysReceived).toBe(0);
});

View File

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