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:
@@ -1021,11 +1021,10 @@ describe("RoomListStoreV3", () => {
|
||||
await store.start();
|
||||
|
||||
const sectionCreatedListener = jest.fn();
|
||||
const listsUpdateListener = jest.fn();
|
||||
store.on(SECTION_CREATED_EVENT, sectionCreatedListener);
|
||||
store.on(LISTS_UPDATE_EVENT, listsUpdateListener);
|
||||
|
||||
await store.createSection();
|
||||
const tag = await store.createSection();
|
||||
expect(tag).toBe("element.io.section.test-tag");
|
||||
|
||||
expect(sectionCreatedListener).toHaveBeenCalledWith("element.io.section.test-tag");
|
||||
});
|
||||
|
||||
@@ -23,14 +23,15 @@ describe("createSection", () => {
|
||||
it.each([
|
||||
[false, "", undefined],
|
||||
[true, "", undefined],
|
||||
])("returns undefined when shouldCreate=%s and name='%s'", async (shouldCreate, name, expected) => {
|
||||
[true, "My Section", expect.stringMatching(/^element\.io\.section\./)],
|
||||
])("returns %s when shouldCreate=%s and name='%s'", async (shouldCreate, name, expected) => {
|
||||
jest.spyOn(Modal, "createDialog").mockReturnValue({
|
||||
finished: Promise.resolve([shouldCreate, name]),
|
||||
close: jest.fn(),
|
||||
} as any);
|
||||
|
||||
const result = await createSection();
|
||||
expect(result).toBe(expected);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
|
||||
it("returns the new tag when section is created", async () => {
|
||||
|
||||
Reference in New Issue
Block a user