Merge branch 'develop' into weeman1337/prettier

This commit is contained in:
Michael Weimann
2022-12-12 16:09:11 +01:00
11 changed files with 286 additions and 29 deletions
+20
View File
@@ -35,11 +35,16 @@ import {
canEditOwnEvent,
fetchInitialEvent,
findEditableEvent,
highlightEvent,
isContentActionable,
isLocationEvent,
isVoiceMessage,
} from "../../src/utils/EventUtils";
import { getMockClientWithEventEmitter, makeBeaconInfoEvent, makePollStartEvent, stubClient } from "../test-utils";
import dis from "../../src/dispatcher/dispatcher";
import { Action } from "../../src/dispatcher/actions";
jest.mock("../../src/dispatcher/dispatcher");
describe("EventUtils", () => {
const userId = "@user:server";
@@ -441,4 +446,19 @@ describe("EventUtils", () => {
).toBeUndefined();
});
});
describe("highlightEvent", () => {
const eventId = "$zLg9jResFQmMO_UKFeWpgLgOgyWrL8qIgLgZ5VywrCQ";
it("should dispatch an action to view the event", () => {
highlightEvent(roomId, eventId);
expect(dis.dispatch).toHaveBeenCalledWith({
action: Action.ViewRoom,
event_id: eventId,
highlighted: true,
room_id: roomId,
metricsTrigger: undefined,
});
});
});
});