File tree Expand file tree Collapse file tree 3 files changed +22
-23
lines changed
Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Original file line number Diff line number Diff line change @@ -418,27 +418,26 @@ export const mockDiscussionLabels: DiscussionLabels = {
418418 ] ,
419419} ;
420420
421+ export const mockDiscussion : Discussion = {
422+ number : 123 ,
423+ title : '1.16.0' ,
424+ isAnswered : false ,
425+ stateReason : 'OPEN' ,
426+ url : 'https://github.com/gitify-app/notifications-test/discussions/612' as Link ,
427+ author : {
428+ login : 'discussion-creator' ,
429+ url : 'https://github.com/discussion-creator' as Link ,
430+ avatar_url : 'https://avatars.githubusercontent.com/u/123456789?v=4' as Link ,
431+ type : 'User' ,
432+ } ,
433+ comments : mockDiscussionComments ,
434+ labels : mockDiscussionLabels ,
435+ } ;
436+
421437export const mockSearchDiscussionsGraphQLResponse : GraphQLSearch < Discussion > = {
422438 data : {
423439 search : {
424- nodes : [
425- {
426- number : 123 ,
427- title : '1.16.0' ,
428- isAnswered : false ,
429- stateReason : 'OPEN' ,
430- url : 'https://github.com/gitify-app/notifications-test/discussions/612' as Link ,
431- author : {
432- login : 'discussion-creator' ,
433- url : 'https://github.com/discussion-creator' as Link ,
434- avatar_url :
435- 'https://avatars.githubusercontent.com/u/123456789?v=4' as Link ,
436- type : 'User' ,
437- } ,
438- comments : mockDiscussionComments ,
439- labels : mockDiscussionLabels ,
440- } ,
441- ] ,
440+ nodes : [ mockDiscussion ] ,
442441 } ,
443442 } ,
444443} ;
Original file line number Diff line number Diff line change @@ -284,4 +284,6 @@ export async function getLatestDiscussion(
284284 notification ,
285285 ) ;
286286 }
287+
288+ return null ;
287289}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import type { Hostname, Link } from '../types';
88import type { SubjectType } from '../typesGitHub' ;
99import * as logger from '../utils/logger' ;
1010import {
11- mockSearchDiscussionsGraphQLResponse ,
11+ mockDiscussion ,
1212 mockSingleNotification ,
1313} from './api/__mocks__/response-mocks' ;
1414import * as apiClient from './api/client' ;
@@ -283,9 +283,7 @@ describe('renderer/utils/helpers.ts', () => {
283283 type : 'Discussion' as SubjectType ,
284284 } ;
285285
286- getLatestDiscussionSpy . mockResolvedValue (
287- mockSearchDiscussionsGraphQLResponse [ 0 ] ,
288- ) ;
286+ getLatestDiscussionSpy . mockResolvedValue ( mockDiscussion ) ;
289287
290288 const result = await generateGitHubWebUrl ( {
291289 ...mockSingleNotification ,
@@ -475,7 +473,7 @@ describe('renderer/utils/helpers.ts', () => {
475473 subject : subject ,
476474 } ) ;
477475
478- expect ( getHtmlUrlSpy ) . toHaveBeenCalledTimes ( 0 ) ;
476+ expect ( getHtmlUrlSpy ) . toHaveBeenCalledTimes ( 1 ) ;
479477 expect ( result ) . toBe (
480478 `https://github.com/gitify-app/notifications-test/issues?${ mockNotificationReferrer } ` ,
481479 ) ;
You can’t perform that action at this time.
0 commit comments