You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-30 04:23:07 +03:00
Fix thread & main timeline partitioning logic (#2264)
This commit is contained in:
committed by
GitHub
parent
4360ae7ff8
commit
d6f1c6cfdc
@ -32,6 +32,7 @@ import { Preset } from "../../src/@types/partials";
|
||||
import * as testUtils from "../test-utils/test-utils";
|
||||
import { makeBeaconInfoContent } from "../../src/content-helpers";
|
||||
import { M_BEACON_INFO } from "../../src/@types/beacon";
|
||||
import { Room } from "../../src";
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
@ -957,6 +958,7 @@ describe("MatrixClient", function() {
|
||||
it("partitions root events to room timeline and thread timeline", () => {
|
||||
const supportsExperimentalThreads = client.supportsExperimentalThreads;
|
||||
client.supportsExperimentalThreads = () => true;
|
||||
const room = new Room("!room1:matrix.org", client, userId);
|
||||
|
||||
const rootEvent = new MatrixEvent({
|
||||
"content": {},
|
||||
@ -979,9 +981,9 @@ describe("MatrixClient", function() {
|
||||
|
||||
expect(rootEvent.isThreadRoot).toBe(true);
|
||||
|
||||
const [room, threads] = client.partitionThreadedEvents([rootEvent]);
|
||||
expect(room).toHaveLength(1);
|
||||
expect(threads).toHaveLength(1);
|
||||
const [roomEvents, threadEvents] = client.partitionThreadedEvents(room, [rootEvent]);
|
||||
expect(roomEvents).toHaveLength(1);
|
||||
expect(threadEvents).toHaveLength(1);
|
||||
|
||||
// Restore method
|
||||
client.supportsExperimentalThreads = supportsExperimentalThreads;
|
||||
|
Reference in New Issue
Block a user