1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-09 08:42:50 +03:00

Use MatrixClientPeg::safeGet for strict typing (#10989)

This commit is contained in:
Michael Telatynski
2023-06-21 17:29:44 +01:00
committed by GitHub
parent d64018ce26
commit 9b5b053148
60 changed files with 225 additions and 203 deletions

View File

@@ -29,6 +29,7 @@ import RoomContext, { TimelineRenderingType } from "../../../src/contexts/RoomCo
import DMRoomMap from "../../../src/utils/DMRoomMap";
import * as TestUtilsMatrix from "../../test-utils";
import {
createTestClient,
getMockClientWithEventEmitter,
makeBeaconInfoEvent,
mockClientMethodsEvents,
@@ -773,16 +774,17 @@ describe("shouldFormContinuation", () => {
msg: "And here's another message in the main timeline after the thread root",
});
expect(shouldFormContinuation(message1, message2, false)).toEqual(true);
expect(shouldFormContinuation(message2, threadRoot, false)).toEqual(true);
expect(shouldFormContinuation(threadRoot, message3, false)).toEqual(true);
const client = createTestClient();
expect(shouldFormContinuation(message1, message2, client, false)).toEqual(true);
expect(shouldFormContinuation(message2, threadRoot, client, false)).toEqual(true);
expect(shouldFormContinuation(threadRoot, message3, client, false)).toEqual(true);
const thread = {
length: 1,
replyToEvent: {},
} as unknown as Thread;
jest.spyOn(threadRoot, "getThread").mockReturnValue(thread);
expect(shouldFormContinuation(message2, threadRoot, false)).toEqual(false);
expect(shouldFormContinuation(threadRoot, message3, false)).toEqual(false);
expect(shouldFormContinuation(message2, threadRoot, client, false)).toEqual(false);
expect(shouldFormContinuation(threadRoot, message3, client, false)).toEqual(false);
});
});