Fix Mark all as read in settings (#12205)

* Fix `Mark all as read` in settings

* Update tests
This commit is contained in:
Florian Duros
2024-02-01 17:58:57 +00:00
committed by GitHub
parent 40ee1bb400
commit 8299abd344
6 changed files with 16 additions and 11 deletions
+5
View File
@@ -421,6 +421,11 @@ describe("Unread", () => {
},
);
});
it("returns false for space", () => {
jest.spyOn(room, "isSpaceRoom").mockReturnValue(true);
expect(doesRoomHaveUnreadMessages(room, false)).toBe(false);
});
});
describe("doesRoomOrThreadHaveUnreadMessages()", () => {
@@ -21,7 +21,6 @@ import {
LOCAL_NOTIFICATION_SETTINGS_PREFIX,
MatrixEvent,
Room,
NotificationCountType,
PushRuleActionName,
TweakName,
ConditionKind,
@@ -31,7 +30,7 @@ import {
ThreepidMedium,
} from "matrix-js-sdk/src/matrix";
import { randomString } from "matrix-js-sdk/src/randomstring";
import { act, fireEvent, getByTestId, render, screen, waitFor, within } from "@testing-library/react";
import { act, fireEvent, getByTestId, render, screen, within } from "@testing-library/react";
import { mocked } from "jest-mock";
import userEvent from "@testing-library/user-event";
@@ -900,8 +899,7 @@ describe("<Notifications />", () => {
user: "@alice:example.org",
ts: 1,
});
room.addLiveEvents([message]);
room.setUnreadNotificationCount(NotificationCountType.Total, 1);
await room.addLiveEvents([message]);
const { container } = await getComponentAndWait();
const clearNotificationEl = getByTestId(container, "clear-notifications");
@@ -910,10 +908,6 @@ describe("<Notifications />", () => {
expect(clearNotificationEl.className).toContain("mx_AccessibleButton_disabled");
expect(mockClient.sendReadReceipt).toHaveBeenCalled();
await waitFor(() => {
expect(clearNotificationEl).not.toBeInTheDocument();
});
});
});
});