You've already forked matrix-js-sdk
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:
@@ -136,7 +136,10 @@ describe("RoomAndToDeviceTransport", () => {
|
|||||||
roomKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "roomKey", 0, dateNow);
|
roomKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "roomKey", 0, dateNow);
|
||||||
toDeviceKeyTransport.emit(KeyTransportEvents.ReceivedKeys, "user", "device", "toDeviceKey", 0, Date.now());
|
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
|
// 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(1, { toDevice: false, room: false });
|
||||||
expect(onTransportEnabled).toHaveBeenNthCalledWith(2, { toDevice: false, room: true });
|
expect(onTransportEnabled).toHaveBeenNthCalledWith(2, { toDevice: false, room: true });
|
||||||
|
@@ -51,9 +51,7 @@ describe("RoomKeyTransport", () => {
|
|||||||
room = makeMockRoom([membershipTemplate]);
|
room = makeMockRoom([membershipTemplate]);
|
||||||
client = new MatrixClient({ baseUrl: "base_url" });
|
client = new MatrixClient({ baseUrl: "base_url" });
|
||||||
client.matrixRTC.start();
|
client.matrixRTC.start();
|
||||||
transport = new RoomKeyTransport(room, client, statistics, {
|
transport = new RoomKeyTransport(room, client, statistics, mockLogger);
|
||||||
getChild: jest.fn().mockReturnValue(mockLogger),
|
|
||||||
} as unknown as Mocked<Logger>);
|
|
||||||
transport.on(KeyTransportEvents.ReceivedKeys, (...p) => {
|
transport.on(KeyTransportEvents.ReceivedKeys, (...p) => {
|
||||||
onCallEncryptionMock(...p);
|
onCallEncryptionMock(...p);
|
||||||
});
|
});
|
||||||
|
@@ -51,9 +51,14 @@ describe("ToDeviceKeyTransport", () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
transport = new ToDeviceKeyTransport("@alice:example.org", "MYDEVICE", roomId, mockClient, statistics, {
|
transport = new ToDeviceKeyTransport(
|
||||||
getChild: jest.fn().mockReturnValue(mockLogger),
|
"@alice:example.org",
|
||||||
} as unknown as Mocked<Logger>);
|
"MYDEVICE",
|
||||||
|
roomId,
|
||||||
|
mockClient,
|
||||||
|
statistics,
|
||||||
|
mockLogger,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should send my keys on via to device", async () => {
|
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);
|
expect(statistics.counters.roomEventEncryptionKeysReceived).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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
|
// 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)
|
// 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 order is required because this method needs to return the action updates.
|
||||||
this.logger.debug(
|
this.logger.debug(`applied action changes. Status: ${this.oldStatus} -> ${this.status}`);
|
||||||
`applied action changes. Status: ${this.oldStatus} -> ${this.status}`,
|
|
||||||
);
|
|
||||||
if (this.oldStatus !== this.status) {
|
if (this.oldStatus !== this.status) {
|
||||||
this.emit(MembershipManagerEvent.StatusChanged, this.oldStatus, this.status);
|
this.emit(MembershipManagerEvent.StatusChanged, this.oldStatus, this.status);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user