Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti committed Nov 18, 2024
1 parent 73ffa11 commit 9e18dfd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/meteor/client/sidebarv2/hooks/useRoomList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,21 @@ it('should add to unread group when has thread unread, even if alert is false',
const unreadGroup = result.current.roomList.splice(0, result.current.groupsCount[0]);
expect(unreadGroup.find((room) => room.name === fakeRoom.name)).toBeDefined();
});

it('should not add room to unread group if thread unread is an empty array', async () => {
const fakeRoom = {
...createFakeSubscription({ ...emptyUnread, tunread: [] }),
} as unknown as SubscriptionWithRoom;

const { result } = renderHook(() => useRoomList({ collapsedGroups: [] }), {
legacyRoot: true,
wrapper: getWrapperSettings({
sidebarGroupByType: true,
sidebarShowUnread: true,
fakeRoom,
}).build(),
});

const unreadGroup = result.current.roomList.splice(0, result.current.groupsCount[0]);
expect(unreadGroup.find((room) => room.name === fakeRoom.name)).toBeUndefined();
});

0 comments on commit 9e18dfd

Please sign in to comment.