@@ -48,6 +48,7 @@ describe('context/App.tsx', () => {
48
48
const markNotificationDoneMock = jest . fn ( ) ;
49
49
const unsubscribeNotificationMock = jest . fn ( ) ;
50
50
const markRepoNotificationsMock = jest . fn ( ) ;
51
+ const markRepoNotificationsDoneMock = jest . fn ( ) ;
51
52
52
53
beforeEach ( ( ) => {
53
54
( useNotifications as jest . Mock ) . mockReturnValue ( {
@@ -56,6 +57,7 @@ describe('context/App.tsx', () => {
56
57
markNotificationDone : markNotificationDoneMock ,
57
58
unsubscribeNotification : unsubscribeNotificationMock ,
58
59
markRepoNotifications : markRepoNotificationsMock ,
60
+ markRepoNotificationsDone : markRepoNotificationsDoneMock ,
59
61
} ) ;
60
62
} ) ;
61
63
@@ -234,6 +236,40 @@ describe('context/App.tsx', () => {
234
236
) ;
235
237
} ) ;
236
238
239
+ it ( 'should call markRepoNotificationsDone' , async ( ) => {
240
+ const TestComponent = ( ) => {
241
+ const { markRepoNotificationsDone } = useContext ( AppContext ) ;
242
+
243
+ return (
244
+ < button
245
+ type = "button"
246
+ onClick = { ( ) =>
247
+ markRepoNotificationsDone (
248
+ 'gitify-app/notifications-test' ,
249
+ 'github.com' ,
250
+ )
251
+ }
252
+ >
253
+ Test Case
254
+ </ button >
255
+ ) ;
256
+ } ;
257
+
258
+ const { getByText } = customRender ( < TestComponent /> ) ;
259
+
260
+ markRepoNotificationsDoneMock . mockReset ( ) ;
261
+
262
+ fireEvent . click ( getByText ( 'Test Case' ) ) ;
263
+
264
+ expect ( markRepoNotificationsDoneMock ) . toHaveBeenCalledTimes ( 1 ) ;
265
+ expect ( markRepoNotificationsDoneMock ) . toHaveBeenCalledWith (
266
+ { enterpriseAccounts : [ ] , token : null , user : null } ,
267
+ mockSettings ,
268
+ 'gitify-app/notifications-test' ,
269
+ 'github.com' ,
270
+ ) ;
271
+ } ) ;
272
+
237
273
it ( 'should call validateToken' , async ( ) => {
238
274
apiRequestAuthMock . mockResolvedValueOnce ( null ) ;
239
275
0 commit comments