@@ -62,7 +62,7 @@ type MockGithubRequests = (
6262 filesOutOfDate : string [ ] ,
6363 changedFilesOnPr : string [ ] ,
6464 branch ?: string ,
65- error ?: { status : number ; message ?: string } | null
65+ error ?: { status : number | string ; message ?: string } | null
6666) => void ;
6767const mockGithubRequests : MockGithubRequests = ( filesOutOfDate , changedFilesOnPr , branch = branchName , error = null ) => {
6868 ( octokit . repos . compareCommitsWithBasehead as unknown as Mocktokit ) . mockImplementation ( async ( { basehead } ) => {
@@ -136,7 +136,7 @@ describe('checkMergeSafety', () => {
136136 expect ( core . setFailed ) . toHaveBeenCalledWith ( 'This branch has one or more outdated projects. Please update with main.' ) ;
137137 } ) ;
138138
139- it ( 'should allow merge when branch is only out of date for an unchanged project - diff too large error' , async ( ) => {
139+ it ( 'should allow merge when branch is only out of date for an unchanged project - diff too large error status ' , async ( ) => {
140140 const filesOutOfDate = [ 'packages/package-2/src/another-file.ts' ] ;
141141 const changedFilesOnPr = [ 'packages/package-1/src/some-file.ts' ] ;
142142 mockGithubRequests ( filesOutOfDate , changedFilesOnPr , branchName , { status : 406 } ) ;
@@ -157,6 +157,30 @@ describe('checkMergeSafety', () => {
157157 expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
158158 } ) ;
159159
160+ it ( 'should allow merge when branch is only out of date for an unchanged project - diff too large error message' , async ( ) => {
161+ const filesOutOfDate = [ 'packages/package-2/src/another-file.ts' ] ;
162+ const changedFilesOnPr = [ 'packages/package-1/src/some-file.ts' ] ;
163+ mockGithubRequests ( filesOutOfDate , changedFilesOnPr , branchName , {
164+ status : 'not_available' ,
165+ message : 'yadda yadda diff is taking too long to generate yadda yadda'
166+ } ) ;
167+ mockGitInteractions ( filesOutOfDate , changedFilesOnPr ) ;
168+
169+ await checkMergeSafety ( {
170+ paths : allProjectPaths ,
171+ ...context . repo
172+ } ) ;
173+ expect ( setCommitStatus ) . toHaveBeenCalledWith ( {
174+ sha,
175+ state : 'success' ,
176+ context : 'Merge Safety' ,
177+ description : 'Branch username:some-branch-name is safe to merge!' ,
178+ repo : 'repo' ,
179+ owner : 'owner'
180+ } ) ;
181+ expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
182+ } ) ;
183+
160184 it ( 'should prevent merge when branch is out of date for a changed project - diff too large error' , async ( ) => {
161185 const filesOutOfDate = [ 'packages/package-1/src/another-file.ts' ] ;
162186 const changedFilesOnPr = [ 'packages/package-1/src/some-file.ts' ] ;
0 commit comments