From d0de2a6851ff21d383ed18f054f8a32f37b06619 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 30 Jan 2023 09:53:41 +0100 Subject: [PATCH] Add test case for no-version-in-hierarchy situation --- test/components/structures/SpaceHierarchy-test.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/components/structures/SpaceHierarchy-test.tsx b/test/components/structures/SpaceHierarchy-test.tsx index 796e8848d4..27e55e95c1 100644 --- a/test/components/structures/SpaceHierarchy-test.tsx +++ b/test/components/structures/SpaceHierarchy-test.tsx @@ -114,5 +114,15 @@ describe("SpaceHierarchy", () => { const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as IHierarchyRoom, hierarchy); expect(localRoomV3.room_id).toEqual(roomV2.roomId); }); + + it("returns specified room when none of the versions is in hierarchy", () => { + const hierarchy = { roomMap: new Map([]) } as RoomHierarchy; + const localRoomV1 = toLocalRoom(client, { room_id: roomV1.roomId } as IHierarchyRoom, hierarchy); + expect(localRoomV1.room_id).toEqual(roomV1.roomId); + const localRoomV2 = toLocalRoom(client, { room_id: roomV2.roomId } as IHierarchyRoom, hierarchy); + expect(localRoomV2.room_id).toEqual(roomV2.roomId); + const localRoomV3 = toLocalRoom(client, { room_id: roomV3.roomId } as IHierarchyRoom, hierarchy); + expect(localRoomV3.room_id).toEqual(roomV3.roomId); + }); }); });