Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Update pinning util tests
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Aug 27, 2024
1 parent e1142c0 commit 5dae313
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test/utils/PinningUtils-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { mocked } from "jest-mock";
import { createTestClient } from "../test-utils";
import PinningUtils from "../../src/utils/PinningUtils";
import SettingsStore from "../../src/settings/SettingsStore";
import { canPinEvent, isContentActionable } from "../../src/utils/EventUtils";
import { isContentActionable } from "../../src/utils/EventUtils";
import { ReadPinsEventId } from "../../src/components/views/right_panel/types";

jest.mock("../../src/utils/EventUtils", () => {
Expand All @@ -35,7 +35,6 @@ describe("PinningUtils", () => {
const userId = "@alice:example.org";

const mockedIsContentActionable = mocked(isContentActionable);
const mockedCanPinEvent = mocked(canPinEvent);

let matrixClient: MatrixClient;
let room: Room;
Expand Down Expand Up @@ -63,7 +62,6 @@ describe("PinningUtils", () => {
// Enable feature pinning
jest.spyOn(SettingsStore, "getValue").mockReturnValue(true);
mockedIsContentActionable.mockImplementation(() => true);
mockedCanPinEvent.mockImplementation(() => true);

matrixClient = createTestClient();
room = new Room(roomId, matrixClient, userId);
Expand Down Expand Up @@ -171,8 +169,7 @@ describe("PinningUtils", () => {
});

test("should return false if event is not pinnable", () => {
mockedCanPinEvent.mockReturnValue(false);
const event = makePinEvent();
const event = makePinEvent({ type: EventType.RoomCreate });

expect(PinningUtils.canPinOrUnpin(matrixClient, event)).toBe(false);
});
Expand Down

0 comments on commit 5dae313

Please sign in to comment.