@@ -152,7 +152,7 @@ describe('utils/helpers.ts', () => {
152
152
describe ( 'generateGitHubWebUrl' , ( ) => {
153
153
const mockedHtmlUrl = 'https://github.com/gitify-app/gitify/issues/785' ;
154
154
const mockedNotificationReferrer =
155
- '? notification_referrer_id=MDE4Ok5vdGlmaWNhdGlvblRocmVhZDEzODY2MTA5NjoxMjM0NTY3ODk%3D' ;
155
+ 'notification_referrer_id=MDE4Ok5vdGlmaWNhdGlvblRocmVhZDEzODY2MTA5NjoxMjM0NTY3ODk%3D' ;
156
156
const apiRequestAuthMock = jest . spyOn ( apiRequests , 'apiRequestAuth' ) ;
157
157
158
158
afterEach ( ( ) => {
@@ -192,7 +192,7 @@ describe('utils/helpers.ts', () => {
192
192
'GET' ,
193
193
mockAccounts . token ,
194
194
) ;
195
- expect ( result ) . toBe ( `${ mockedHtmlUrl } ${ mockedNotificationReferrer } ` ) ;
195
+ expect ( result ) . toBe ( `${ mockedHtmlUrl } ? ${ mockedNotificationReferrer } ` ) ;
196
196
} ) ;
197
197
198
198
it ( 'Subject Url: when no latest comment url available, fetch subject html url' , async ( ) => {
@@ -227,7 +227,7 @@ describe('utils/helpers.ts', () => {
227
227
'GET' ,
228
228
mockAccounts . token ,
229
229
) ;
230
- expect ( result ) . toBe ( `${ mockedHtmlUrl } ${ mockedNotificationReferrer } ` ) ;
230
+ expect ( result ) . toBe ( `${ mockedHtmlUrl } ? ${ mockedNotificationReferrer } ` ) ;
231
231
} ) ;
232
232
233
233
it ( 'Discussions: when no subject urls and no discussions found via query, default to linking to repository discussions' , async ( ) => {
@@ -256,7 +256,7 @@ describe('utils/helpers.ts', () => {
256
256
257
257
expect ( apiRequestAuthMock ) . toHaveBeenCalledTimes ( 1 ) ;
258
258
expect ( result ) . toBe (
259
- `${ mockedSingleNotification . repository . html_url } /discussions${ mockedNotificationReferrer } ` ,
259
+ `${ mockedSingleNotification . repository . html_url } /discussions? ${ mockedNotificationReferrer } ` ,
260
260
) ;
261
261
} ) ;
262
262
@@ -268,8 +268,6 @@ describe('utils/helpers.ts', () => {
268
268
type : 'Discussion' as SubjectType ,
269
269
} ;
270
270
271
- // const latestDiscussionCommentId = 12345;
272
-
273
271
const requestPromise = new Promise ( ( resolve ) =>
274
272
resolve ( mockedGraphQLResponse as AxiosResponse ) ,
275
273
) as AxiosPromise ;
@@ -286,7 +284,29 @@ describe('utils/helpers.ts', () => {
286
284
287
285
expect ( apiRequestAuthMock ) . toHaveBeenCalledTimes ( 1 ) ;
288
286
expect ( result ) . toBe (
289
- 'https://github.com/manosim/notifications-test/discussions/612?notification_referrer_id=MDE4Ok5vdGlmaWNhdGlvblRocmVhZDEzODY2MTA5NjoxMjM0NTY3ODk%3D#discussioncomment-2300902' ,
287
+ `https://github.com/manosim/notifications-test/discussions/612?${ mockedNotificationReferrer } #discussioncomment-2300902` ,
288
+ ) ;
289
+ } ) ;
290
+
291
+ it ( 'Repository Invitation url' , async ( ) => {
292
+ const subject = {
293
+ title : 'Invitation to join manosim/notifications-test from unit-tests' ,
294
+ url : null ,
295
+ latest_comment_url : null ,
296
+ type : 'RepositoryInvitation' as SubjectType ,
297
+ } ;
298
+
299
+ const result = await generateGitHubWebUrl (
300
+ {
301
+ ...mockedSingleNotification ,
302
+ subject : subject ,
303
+ } ,
304
+ mockAccounts ,
305
+ ) ;
306
+
307
+ expect ( apiRequestAuthMock ) . toHaveBeenCalledTimes ( 0 ) ;
308
+ expect ( result ) . toBe (
309
+ `https://github.com/manosim/notifications-test/invitations?${ mockedNotificationReferrer } ` ,
290
310
) ;
291
311
} ) ;
292
312
@@ -308,7 +328,7 @@ describe('utils/helpers.ts', () => {
308
328
309
329
expect ( apiRequestAuthMock ) . toHaveBeenCalledTimes ( 0 ) ;
310
330
expect ( result ) . toBe (
311
- `${ mockedSingleNotification . repository . html_url } ${ mockedNotificationReferrer } ` ,
331
+ `${ mockedSingleNotification . repository . html_url } ? ${ mockedNotificationReferrer } ` ,
312
332
) ;
313
333
} ) ;
314
334
} ) ;
0 commit comments