diff --git a/test/stores/room-list/SlidingRoomListStore-test.ts b/test/stores/room-list/SlidingRoomListStore-test.ts index 64e7bfaa97..3014423349 100644 --- a/test/stores/room-list/SlidingRoomListStore-test.ts +++ b/test/stores/room-list/SlidingRoomListStore-test.ts @@ -30,7 +30,7 @@ import { RoomViewStore } from "../../../src/stores/RoomViewStore"; import { MatrixDispatcher } from "../../../src/dispatcher/dispatcher"; import { SortAlgorithm } from "../../../src/stores/room-list/algorithms/models"; import { DefaultTagID, TagID } from "../../../src/stores/room-list/models"; -import { UPDATE_SELECTED_SPACE } from "../../../src/stores/spaces"; +import { MetaSpace, UPDATE_SELECTED_SPACE } from "../../../src/stores/spaces"; import { LISTS_LOADING_EVENT } from "../../../src/stores/room-list/RoomListStore"; import { UPDATE_EVENT } from "../../../src/stores/AsyncStore"; @@ -92,6 +92,23 @@ describe("SlidingRoomListStore", () => { }); }); + it("gracefully handles subspaces in the home metaspace", async () => { + const subspace = "!sub:space"; + mocked(context._SpaceStore!.traverseSpace).mockImplementation( + (spaceId: string, fn: (roomId: string) => void) => { + fn(subspace); + }, + ); + activeSpace = MetaSpace.Home; + await store.start(); // call onReady + + expect(context._SlidingSyncManager!.ensureListRegistered).toHaveBeenCalledWith(DefaultTagID.Untagged, { + filters: expect.objectContaining({ + spaces: [subspace], + }), + }); + }); + it("alters 'filters.spaces' on the DefaultTagID.Untagged list if it loads with an active space", async () => { // change the active space before we are ready const spaceRoomId = "!foo2:bar";