@@ -136,6 +136,32 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => {
136136 expect ( markNotificationsAsDoneMock ) . toHaveBeenCalledTimes ( 1 ) ;
137137 } ) ;
138138
139+ it ( 'should mark as read (not done) when markAsDoneOnOpen is true but fetchReadNotifications is enabled' , async ( ) => {
140+ const markNotificationsAsReadMock = jest . fn ( ) ;
141+ const markNotificationsAsDoneMock = jest . fn ( ) ;
142+
143+ const props = {
144+ notification : mockGitifyNotification ,
145+ account : mockGitHubCloudAccount ,
146+ } ;
147+
148+ renderWithAppContext ( < NotificationRow { ...props } /> , {
149+ settings : {
150+ ...mockSettings ,
151+ markAsDoneOnOpen : true ,
152+ fetchReadNotifications : true ,
153+ } ,
154+ markNotificationsAsRead : markNotificationsAsReadMock ,
155+ markNotificationsAsDone : markNotificationsAsDoneMock ,
156+ } ) ;
157+
158+ await userEvent . click ( screen . getByTestId ( 'notification-row' ) ) ;
159+
160+ expect ( links . openNotification ) . toHaveBeenCalledTimes ( 1 ) ;
161+ expect ( markNotificationsAsReadMock ) . toHaveBeenCalledTimes ( 1 ) ;
162+ expect ( markNotificationsAsDoneMock ) . not . toHaveBeenCalled ( ) ;
163+ } ) ;
164+
139165 it ( 'should mark notifications as read' , async ( ) => {
140166 const markNotificationsAsReadMock = jest . fn ( ) ;
141167
@@ -190,6 +216,24 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => {
190216 expect ( markNotificationsAsDoneMock ) . toHaveBeenCalledTimes ( 1 ) ;
191217 } ) ;
192218
219+ it ( 'should hide mark as done button when fetchReadNotifications is enabled' , async ( ) => {
220+ const props = {
221+ notification : mockGitifyNotification ,
222+ account : mockGitHubCloudAccount ,
223+ } ;
224+
225+ renderWithAppContext ( < NotificationRow { ...props } /> , {
226+ settings : { ...mockSettings , fetchReadNotifications : true } ,
227+ } ) ;
228+
229+ expect (
230+ screen . queryByTestId ( 'notification-mark-as-done' ) ,
231+ ) . not . toBeInTheDocument ( ) ;
232+ expect (
233+ screen . getByTestId ( 'notification-mark-as-read' ) ,
234+ ) . toBeInTheDocument ( ) ;
235+ } ) ;
236+
193237 it ( 'should unsubscribe from a notification thread' , async ( ) => {
194238 const unsubscribeNotificationMock = jest . fn ( ) ;
195239
0 commit comments