























@@ -53,7 +53,7 @@ describe("resolveMatrixRoomId", () => {
5353const roomId = await resolveMatrixRoomId(client, userId);
54545555expect(roomId).toBe("!room:example.org");
56-expect(client.getJoinedRooms).not.toHaveBeenCalled();
56+expect(client.getJoinedRooms).toHaveBeenCalledTimes(1);
5757expect(client.setAccountData).not.toHaveBeenCalled();
5858});
5959@@ -65,10 +65,7 @@ describe("resolveMatrixRoomId", () => {
6565const resolved = await resolveMatrixRoomId(client, userId);
66666767expect(resolved).toBe(roomId);
68-expect(client.setAccountData).toHaveBeenCalledWith(
69-EventType.Direct,
70-expect.objectContaining({ [userId]: [roomId] }),
71-);
68+expect(client.setAccountData).toHaveBeenCalledWith(EventType.Direct, { [userId]: [roomId] });
7269});
73707471it("prefers joined rooms marked direct in local member state over plain strict rooms", async () => {
@@ -90,10 +87,9 @@ describe("resolveMatrixRoomId", () => {
9087const resolved = await resolveMatrixRoomId(client, userId);
91889289expect(resolved).toBe("!explicit:example.org");
93-expect(client.setAccountData).toHaveBeenCalledWith(
94-EventType.Direct,
95-expect.objectContaining({ [userId]: ["!explicit:example.org"] }),
96-);
90+expect(client.setAccountData).toHaveBeenCalledWith(EventType.Direct, {
91+[userId]: ["!explicit:example.org"],
92+});
9793});
98949995it("ignores remote member-state direct flags when resolving a direct room", async () => {
@@ -115,10 +111,9 @@ describe("resolveMatrixRoomId", () => {
115111const resolved = await resolveMatrixRoomId(client, userId);
116112117113expect(resolved).toBe("!fallback:example.org");
118-expect(client.setAccountData).toHaveBeenCalledWith(
119-EventType.Direct,
120-expect.objectContaining({ [userId]: ["!fallback:example.org"] }),
121-);
114+expect(client.setAccountData).toHaveBeenCalledWith(EventType.Direct, {
115+[userId]: ["!fallback:example.org"],
116+});
122117});
123118124119it("continues when a room member lookup fails", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。