@@ -8,10 +8,8 @@ import {
88import type { SubjectType } from '../typesGitHub' ;
99import * as apiRequests from './api/request' ;
1010import {
11- addHours ,
1211 addNotificationReferrerIdToUrl ,
1312 formatForDisplay ,
14- formatSearchQueryString ,
1513 generateGitHubWebUrl ,
1614 generateNotificationReferrerId ,
1715 getGitHubAPIBaseUrl ,
@@ -102,33 +100,6 @@ describe('utils/helpers.ts', () => {
102100 } ) ;
103101 } ) ;
104102
105- describe ( 'addHours' , ( ) => {
106- // Example test using Jest
107- test ( 'adds hours correctly for positive values' , ( ) => {
108- const result = addHours ( '2024-02-20T12:00:00.000Z' , 3 ) ;
109- expect ( result ) . toBe ( '2024-02-20T15:00:00.000Z' ) ;
110- } ) ;
111-
112- test ( 'adds hours correctly for negative values' , ( ) => {
113- const result = addHours ( '2024-02-20T12:00:00.000Z' , - 2 ) ;
114- expect ( result ) . toBe ( '2024-02-20T10:00:00.000Z' ) ;
115- } ) ;
116- } ) ;
117-
118- describe ( 'formatSearchQueryString' , ( ) => {
119- test ( 'formats search query string correctly' , ( ) => {
120- const result = formatSearchQueryString (
121- 'exampleRepo' ,
122- 'exampleTitle' ,
123- '2024-02-20T12:00:00.000Z' ,
124- ) ;
125-
126- expect ( result ) . toBe (
127- 'exampleTitle in:title repo:exampleRepo updated:>2024-02-20T10:00:00.000Z' ,
128- ) ;
129- } ) ;
130- } ) ;
131-
132103 describe ( 'generateGitHubWebUrl' , ( ) => {
133104 const mockedHtmlUrl =
134105 'https://github.com/gitify-app/notifications-test/issues/785' ;
@@ -398,7 +369,7 @@ describe('utils/helpers.ts', () => {
398369 ) ;
399370 } ) ;
400371
401- it ( 'when no subject urls and no discussions found via query, default to linking to repository discussions ' , async ( ) => {
372+ it ( 'link to matching discussion and comment hash ' , async ( ) => {
402373 const subject = {
403374 title : '1.16.0' ,
404375 url : null ,
@@ -407,7 +378,11 @@ describe('utils/helpers.ts', () => {
407378 } ;
408379
409380 const requestPromise = new Promise ( ( resolve ) =>
410- resolve ( mockedGraphQLResponse as AxiosResponse ) ,
381+ resolve ( {
382+ data : {
383+ ...mockedGraphQLResponse ,
384+ } ,
385+ } as AxiosResponse ) ,
411386 ) as AxiosPromise ;
412387
413388 apiRequestAuthMock . mockResolvedValue ( requestPromise ) ;
0 commit comments