@@ -93,7 +93,7 @@ describe("outputMergedBranches", () => {
9393
9494 it ( "should log the correct branches when there are remote merged branches" , ( ) => {
9595 const branches = [ "feat/TOKEN-800_new-feature" , "fix/TOKEN-123_some-fix" ] ;
96- vi . spyOn ( repoMethods , "fetchRemoteBranches" ) . mockReturnValue ( branches ) ;
96+ const spy = vi . spyOn ( repoMethods , "fetchRemoteBranches" ) . mockReturnValue ( branches ) ;
9797
9898 outputMergedBranches ( branches , "master" , DEFAULT_CONFIG ) ;
9999 expect ( infoSpy ) . toHaveBeenNthCalledWith ( 1 , "2 branches merged into 'master':" ) ;
@@ -110,8 +110,24 @@ describe("outputMergedBranches", () => {
110110 expect ( infoSpy ) . toHaveBeenNthCalledWith ( 5 , `remotely:\n ${ remoteDelete } ` ) ;
111111 expect ( infoSpy ) . toHaveBeenCalledTimes ( 5 ) ;
112112 expect ( warnSpy ) . not . toHaveBeenCalled ( ) ;
113+
114+ spy . mockRestore ( ) ;
113115 } ) ;
114116
117+ it ( "should log the correct messages when there is single local merged branch" , ( ) => {
118+ const branches = [ "feat/TOKEN-800_new-feature" ] ;
119+
120+ outputMergedBranches ( branches , "master" , DEFAULT_CONFIG ) ;
121+ expect ( infoSpy ) . toHaveBeenNthCalledWith ( 1 , "1 branch merged into 'master':" ) ;
122+ expect ( infoSpy ) . toHaveBeenNthCalledWith ( 2 , "feat/TOKEN-800_new-feature <https://test-instance.org/browse/TOKEN-800>" ) ;
123+
124+ const localDelete = `git branch --delete ${ branches . join ( " " ) } ` ;
125+ expect ( infoSpy ) . toHaveBeenNthCalledWith ( 3 , "\nRun the following to delete branches:" ) ;
126+ expect ( infoSpy ) . toHaveBeenNthCalledWith ( 4 , `locally:\n ${ localDelete } ` ) ;
127+ expect ( infoSpy ) . toHaveBeenCalledTimes ( 4 ) ;
128+ expect ( warnSpy ) . not . toHaveBeenCalled ( ) ;
129+ } )
130+
115131 it ( "should log a message when no branches are merged" , ( ) => {
116132 outputMergedBranches ( [ ] , "master" , DEFAULT_CONFIG ) ;
117133 expect ( infoSpy ) . toHaveBeenCalledWith ( "No branches merged into 'master'." ) ;
0 commit comments