Add test case for no-version-in-hierarchy situation

pull/28217/head
Johannes Marbach 2023-01-30 09:53:41 +01:00
parent a5d8c8162d
commit d0de2a6851
1 changed files with 10 additions and 0 deletions

View File

@ -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);
});
});
});