File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -944,6 +944,25 @@ describe('test `handlePullRequest`', () => {
944944 expect ( updated ) . toEqual ( false ) ;
945945 expect ( updateSpy ) . toHaveBeenCalledTimes ( 1 ) ;
946946 } ) ;
947+
948+ test ( 'pull request head repo is null, should log error and return false' , async ( ) => {
949+ const dummyPullRequestEvent = {
950+ action : 'synchronize' ,
951+ pull_request : {
952+ head : {
953+ repo : null ,
954+ } ,
955+ } ,
956+ } as any ;
957+ const updater = new AutoUpdater ( config , dummyPullRequestEvent ) ;
958+ const errorSpy = jest . spyOn ( core , 'error' ) . mockImplementation ( ( ) => { } ) ;
959+ const result = await updater . handlePullRequest ( ) ;
960+ expect ( result ) . toBe ( false ) ;
961+ expect ( errorSpy ) . toHaveBeenCalledWith (
962+ 'Pull request head repo is null, skipping update.' ,
963+ ) ;
964+ errorSpy . mockRestore ( ) ;
965+ } ) ;
947966} ) ;
948967
949968describe ( 'test `update`' , ( ) => {
You can’t perform that action at this time.
0 commit comments