diff --git a/src/renderer/__mocks__/state-mocks.ts b/src/renderer/__mocks__/state-mocks.ts index 63ad1f1c0..15f057f96 100644 --- a/src/renderer/__mocks__/state-mocks.ts +++ b/src/renderer/__mocks__/state-mocks.ts @@ -43,6 +43,7 @@ const mockNotificationSettings: NotificationSettingsState = { showPills: true, showNumber: true, participating: false, + showReadNotifications: false, markAsDoneOnOpen: false, markAsDoneOnUnsubscribe: false, delayNotificationState: false, diff --git a/src/renderer/components/notifications/NotificationRow.test.tsx b/src/renderer/components/notifications/NotificationRow.test.tsx index 14ed55fc6..58e22aadc 100644 --- a/src/renderer/components/notifications/NotificationRow.test.tsx +++ b/src/renderer/components/notifications/NotificationRow.test.tsx @@ -154,6 +154,24 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { expect(markNotificationsAsReadMock).toHaveBeenCalledTimes(1); }); + it('should hide mark as read button when notification is already read', async () => { + const readNotification = { + ...mockSingleNotification, + unread: false, + }; + + const props = { + notification: readNotification, + account: mockGitHubCloudAccount, + }; + + renderWithAppContext(); + + expect( + screen.queryByTestId('notification-mark-as-read'), + ).not.toBeInTheDocument(); + }); + it('should mark notifications as done', async () => { const markNotificationsAsDoneMock = jest.fn(); diff --git a/src/renderer/components/notifications/NotificationRow.tsx b/src/renderer/components/notifications/NotificationRow.tsx index c158689c6..6f61ea8ba 100644 --- a/src/renderer/components/notifications/NotificationRow.tsx +++ b/src/renderer/components/notifications/NotificationRow.tsx @@ -148,6 +148,7 @@ export const NotificationRow: FC = ({ - - +
+ + + +