1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-09 08:42:50 +03:00

Fix RoomViewStore forgetting some details of a view room call (#7512)

This commit is contained in:
Michael Telatynski
2022-01-12 20:12:28 +00:00
committed by GitHub
parent 3a18fd8f71
commit ec6c1b8272
21 changed files with 67 additions and 57 deletions

View File

@@ -34,6 +34,7 @@ import { MatrixClientPeg } from "../../src/MatrixClientPeg";
import defaultDispatcher from "../../src/dispatcher/dispatcher";
import SettingsStore from "../../src/settings/SettingsStore";
import { SettingLevel } from "../../src/settings/SettingLevel";
import { Action } from "../../src/dispatcher/actions";
jest.useFakeTimers();
@@ -92,7 +93,7 @@ describe("SpaceStore", () => {
let rooms = [];
const mkRoom = (roomId: string) => testUtils.mkRoom(client, roomId, rooms);
const mkSpace = (spaceId: string, children: string[] = []) => testUtils.mkSpace(client, spaceId, rooms, children);
const viewRoom = roomId => defaultDispatcher.dispatch({ action: "view_room", room_id: roomId }, true);
const viewRoom = roomId => defaultDispatcher.dispatch({ action: Action.ViewRoom, room_id: roomId }, true);
const run = async () => {
client.getRoom.mockImplementation(roomId => rooms.find(room => room.roomId === roomId));
@@ -680,7 +681,7 @@ describe("SpaceStore", () => {
await run();
dispatcherRef = defaultDispatcher.register(payload => {
if (payload.action === "view_room" || payload.action === "view_home_page") {
if (payload.action === Action.ViewRoom || payload.action === "view_home_page") {
currentRoom = payload.room_id || null;
}
});