@@ -54,12 +54,21 @@ describe('GitHub issue retrieval', () => {
5454 expect ( snapshot . issues [ 0 ] ) . toMatchObject ( { number : 8 , trust : 'requires-approval' } ) ;
5555 } ) ;
5656
57+ it ( 'accepts the maximum bounded issue body' , async ( ) => {
58+ const gateway = new GhIssueGateway ( 'owner/repo' , async ( ) => JSON . stringify ( [
59+ rawIssue ( { body : 'x' . repeat ( 65_536 ) } ) ,
60+ ] ) ) ;
61+ const snapshot = await gateway . fetch ( ) ;
62+ expect ( snapshot . issues [ 0 ] ?. body ) . toHaveLength ( 65_536 ) ;
63+ } ) ;
64+
5765 it . each ( [
5866 [ 'repository URL' , { html_url : 'https://github.com/other/repo/issues/7' } ] ,
5967 [ 'state' , { state : 'closed' } ] ,
6068 [ 'pull request marker' , { pull_request : { } } ] ,
6169 [ 'author association' , { author_association : 'UNKNOWN' } ] ,
6270 [ 'title' , { title : ' ' } ] ,
71+ [ 'body length' , { body : 'x' . repeat ( 65_537 ) } ] ,
6372 [ 'comments' , { comments : - 1 } ] ,
6473 [ 'reactions' , { reactions : { '+1' : 0 , heart : 0 , hooray : 0 } } ] ,
6574 [ 'labels' , { labels : [ { name : 'bug' } , { name : 'BUG' } ] } ] ,
@@ -103,4 +112,14 @@ describe('GitHub issue retrieval', () => {
103112 await expect ( first ) . rejects . toBe ( cancelled ) ;
104113 await expect ( new GhIssueGateway ( 'owner/repo' , run ) . fetch ( { timeoutMs : 1 } ) ) . rejects . toThrow ( 'timed out' ) ;
105114 } ) ;
115+
116+ it ( 'rechecks caller cancellation after a runner returns successfully' , async ( ) => {
117+ const controller = new AbortController ( ) ;
118+ const cancelled = new Error ( 'Stopped while the response settled.' ) ;
119+ const gateway = new GhIssueGateway ( 'owner/repo' , async ( ) => {
120+ controller . abort ( cancelled ) ;
121+ return JSON . stringify ( [ rawIssue ( ) ] ) ;
122+ } ) ;
123+ await expect ( gateway . fetch ( { signal : controller . signal } ) ) . rejects . toBe ( cancelled ) ;
124+ } ) ;
106125} ) ;
0 commit comments