Room list: assign room to section when section is created (#33240)
* feat(rls): return section tag when created * feat(vm): assign section tag to room when section created * test: update exisiting tests * test(e2e): check that room is in section
This commit is contained in:
@@ -315,7 +315,9 @@ describe("RoomListHeaderViewModel", () => {
|
||||
});
|
||||
|
||||
it("should call createSection on RoomListStoreV3 when createSection is called", () => {
|
||||
const createSectionSpy = jest.spyOn(RoomListStoreV3.instance, "createSection").mockResolvedValue();
|
||||
const createSectionSpy = jest
|
||||
.spyOn(RoomListStoreV3.instance, "createSection")
|
||||
.mockResolvedValue("element.io.section.work");
|
||||
vm = new RoomListHeaderViewModel({ matrixClient, spaceStore: SpaceStore.instance });
|
||||
vm.createSection();
|
||||
expect(createSectionSpy).toHaveBeenCalled();
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
type RoomMember,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { CallType } from "matrix-js-sdk/src/webrtc/call";
|
||||
import { waitFor } from "jest-matrix-react";
|
||||
|
||||
import { createTestClient, flushPromises } from "../../test-utils";
|
||||
import { RoomNotificationState } from "../../../src/stores/notifications/RoomNotificationState";
|
||||
@@ -591,11 +592,17 @@ describe("RoomListItemViewModel", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should call createSection on RoomListStoreV3 when onCreateSection is called", () => {
|
||||
const createSectionSpy = jest.spyOn(RoomListStoreV3.instance, "createSection").mockResolvedValue();
|
||||
it("should call createSection on RoomListStoreV3 when onCreateSection is called", async () => {
|
||||
const createSectionSpy = jest
|
||||
.spyOn(RoomListStoreV3.instance, "createSection")
|
||||
.mockResolvedValue("element.io.section.work");
|
||||
const tagRoomSpy = jest.spyOn(tagRoomModule, "tagRoom").mockImplementation(() => {});
|
||||
|
||||
viewModel = new RoomListItemViewModel({ room, client: matrixClient });
|
||||
viewModel.onCreateSection();
|
||||
expect(createSectionSpy).toHaveBeenCalled();
|
||||
|
||||
await waitFor(() => expect(tagRoomSpy).toHaveBeenCalledWith(room, "element.io.section.work"));
|
||||
});
|
||||
|
||||
it("should call tagRoom when onToggleSection is called", () => {
|
||||
|
||||
Reference in New Issue
Block a user