1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Ignore activity in TAC (#12269)

This commit is contained in:
Florian Duros
2024-02-21 13:19:25 +01:00
committed by GitHub
parent 6d55ce0217
commit d9a20b00e0
4 changed files with 36 additions and 60 deletions

View File

@@ -51,6 +51,28 @@ describe("useUnreadThreadRooms", () => {
expect(rooms.length).toEqual(0);
});
it("an activity notification is ignored", async () => {
const notifThreadInfo = await populateThread({
room: room,
client: client,
authorId: "@foo:bar",
participantUserIds: ["@fee:bar"],
});
room.setThreadUnreadNotificationCount(notifThreadInfo.thread.id, NotificationCountType.Total, 0);
client.getVisibleRooms = jest.fn().mockReturnValue([room]);
const wrapper = ({ children }: { children: React.ReactNode }) => (
<MatrixClientContext.Provider value={client}>{children}</MatrixClientContext.Provider>
);
const { result } = renderHook(() => useUnreadThreadRooms(true), { wrapper });
const { greatestNotificationLevel, rooms } = result.current;
expect(greatestNotificationLevel).toBe(NotificationLevel.None);
expect(rooms.length).toEqual(0);
});
it("a notification and a highlight summarise to a highlight", async () => {
const notifThreadInfo = await populateThread({
room: room,
@@ -107,7 +129,7 @@ describe("useUnreadThreadRooms", () => {
const { result } = renderHook(() => useUnreadThreadRooms(true), { wrapper });
expect(result.current.greatestNotificationLevel).toBe(NotificationLevel.Activity);
expect(result.current.greatestNotificationLevel).toBe(NotificationLevel.None);
act(() => {
room.setThreadUnreadNotificationCount(notifThreadInfo.thread.id, NotificationCountType.Highlight, 1);