@@ -472,6 +472,25 @@ describe('renderer/utils/subject.ts', () => {
472472 labels : [ 'enhancement' ] ,
473473 } ) ;
474474 } ) ;
475+
476+ it ( 'early return if discussion state filtered' , async ( ) => {
477+ nock ( 'https://api.github.com' )
478+ . post ( '/graphql' )
479+ . reply ( 200 , {
480+ data : {
481+ search : {
482+ nodes : [ mockDiscussionNode ( null , false ) ] ,
483+ } ,
484+ } ,
485+ } ) ;
486+
487+ const result = await getGitifySubjectDetails ( mockNotification , {
488+ ...mockSettings ,
489+ filterStates : [ 'closed' ] ,
490+ } ) ;
491+
492+ expect ( result ) . toEqual ( null ) ;
493+ } ) ;
475494 } ) ;
476495
477496 describe ( 'Issues' , ( ) => {
@@ -751,6 +770,24 @@ describe('renderer/utils/subject.ts', () => {
751770 } ) ;
752771 } ) ;
753772 } ) ;
773+
774+ it ( 'early return if issue state filtered out' , async ( ) => {
775+ nock ( 'https://api.github.com' )
776+ . get ( '/repos/gitify-app/notifications-test/issues/1' )
777+ . reply ( 200 , {
778+ number : 123 ,
779+ state : 'open' ,
780+ user : mockAuthor ,
781+ labels : [ ] ,
782+ } ) ;
783+
784+ const result = await getGitifySubjectDetails ( mockNotification , {
785+ ...mockSettings ,
786+ filterStates : [ 'closed' ] ,
787+ } ) ;
788+
789+ expect ( result ) . toEqual ( null ) ;
790+ } ) ;
754791 } ) ;
755792
756793 describe ( 'Pull Requests' , ( ) => {
@@ -1182,6 +1219,26 @@ describe('renderer/utils/subject.ts', () => {
11821219 expect ( result ) . toEqual ( [ '#1' , '#2' , '#3' ] ) ;
11831220 } ) ;
11841221 } ) ;
1222+
1223+ it ( 'early return if pull request state filtered' , async ( ) => {
1224+ nock ( 'https://api.github.com' )
1225+ . get ( '/repos/gitify-app/notifications-test/pulls/1' )
1226+ . reply ( 200 , {
1227+ number : 123 ,
1228+ state : 'open' ,
1229+ draft : false ,
1230+ merged : false ,
1231+ user : mockAuthor ,
1232+ labels : [ ] ,
1233+ } ) ;
1234+
1235+ const result = await getGitifySubjectDetails ( mockNotification , {
1236+ ...mockSettings ,
1237+ filterStates : [ 'closed' ] ,
1238+ } ) ;
1239+
1240+ expect ( result ) . toEqual ( null ) ;
1241+ } ) ;
11851242 } ) ;
11861243
11871244 describe ( 'Releases' , ( ) => {
0 commit comments