@@ -277,8 +277,8 @@ describe('modules/platform/gerrit/scm', () => {
277277 } ) ;
278278 } ) ;
279279
280- describe ( 'commitFiles ()' , ( ) => {
281- it ( 'commitFiles () - empty commit' , async ( ) => {
280+ describe ( 'commitAndPush ()' , ( ) => {
281+ it ( 'commitAndPush () - empty commit' , async ( ) => {
282282 clientMock . findChanges . mockResolvedValueOnce ( [ ] ) ;
283283 git . prepareCommit . mockResolvedValueOnce ( null ) ; //empty commit
284284
@@ -303,7 +303,7 @@ describe('modules/platform/gerrit/scm', () => {
303303 ) ;
304304 } ) ;
305305
306- it ( 'commitFiles () - create first Patch ' , async ( ) => {
306+ it ( 'commitAndPush () - create first commit ' , async ( ) => {
307307 clientMock . findChanges . mockResolvedValueOnce ( [ ] ) ;
308308 git . prepareCommit . mockResolvedValueOnce ( {
309309 commitSha : 'commitSha' as LongCommitSha ,
@@ -337,43 +337,7 @@ describe('modules/platform/gerrit/scm', () => {
337337 expect ( git . pushCommit ) . not . toHaveBeenCalled ( ) ;
338338 } ) ;
339339
340- it ( 'commitFiles() - create first Patch - auto approve' , async ( ) => {
341- clientMock . findChanges . mockResolvedValueOnce ( [ ] ) ;
342- git . prepareCommit . mockResolvedValueOnce ( {
343- commitSha : 'commitSha' as LongCommitSha ,
344- parentCommitSha : 'parentSha' as LongCommitSha ,
345- files : [ ] ,
346- } ) ;
347-
348- expect (
349- await gerritScm . commitAndPush ( {
350- branchName : 'renovate/dependency-1.x' ,
351- baseBranch : 'main' ,
352- message : 'commit msg' ,
353- files : [ ] ,
354- prTitle : 'pr title' ,
355- autoApprove : true ,
356- } ) ,
357- ) . toBe ( 'commitSha' ) ;
358- expect ( git . prepareCommit ) . toHaveBeenCalledExactlyOnceWith ( {
359- baseBranch : 'main' ,
360- branchName : 'renovate/dependency-1.x' ,
361- files : [ ] ,
362- message : [
363- 'pr title' ,
364- expect . stringMatching (
365- / ^ R e n o v a t e - B r a n c h : r e n o v a t e \/ d e p e n d e n c y - 1 \. x \n C h a n g e - I d : I [ a - z 0 - 9 ] { 40 } $ / ,
366- ) ,
367- ] ,
368- prTitle : 'pr title' ,
369- autoApprove : true ,
370- force : true ,
371- } ) ;
372- // For new changes, push should NOT be called - it will be done by createPr()
373- expect ( git . pushCommit ) . not . toHaveBeenCalled ( ) ;
374- } ) ;
375-
376- it ( 'commitFiles() - existing change-set without new changes' , async ( ) => {
340+ it ( 'commitAndPush() - existing change without new changes' , async ( ) => {
377341 const existingChange = partial < GerritChange > ( {
378342 change_id : '...' ,
379343 current_revision : 'commitSha' ,
@@ -416,7 +380,7 @@ describe('modules/platform/gerrit/scm', () => {
416380 expect ( git . pushCommit ) . toHaveBeenCalledTimes ( 0 ) ;
417381 } ) ;
418382
419- it ( 'commitFiles () - existing change-set with new changes - auto-approve again ' , async ( ) => {
383+ it ( 'commitAndPush () - existing change with new changes - auto-approve' , async ( ) => {
420384 const existingChange = partial < GerritChange > ( {
421385 _number : 123456 ,
422386 change_id : '...' ,
@@ -467,45 +431,7 @@ describe('modules/platform/gerrit/scm', () => {
467431 } ) ;
468432 } ) ;
469433
470- it ( 'commitFiles() - create first patch - with labels' , async ( ) => {
471- clientMock . findChanges . mockResolvedValueOnce ( [ ] ) ;
472- git . prepareCommit . mockResolvedValueOnce ( {
473- commitSha : 'commitSha' as LongCommitSha ,
474- parentCommitSha : 'parentSha' as LongCommitSha ,
475- files : [ ] ,
476- } ) ;
477-
478- expect (
479- await gerritScm . commitAndPush ( {
480- branchName : 'renovate/dependency-1.x' ,
481- baseBranch : 'main' ,
482- message : 'commit msg' ,
483- files : [ ] ,
484- prTitle : 'pr title' ,
485- autoApprove : true ,
486- labels : [ 'hashtag1' , 'hashtag2' ] ,
487- } ) ,
488- ) . toBe ( 'commitSha' ) ;
489- expect ( git . prepareCommit ) . toHaveBeenCalledExactlyOnceWith ( {
490- baseBranch : 'main' ,
491- branchName : 'renovate/dependency-1.x' ,
492- files : [ ] ,
493- message : [
494- 'pr title' ,
495- expect . stringMatching (
496- / ^ R e n o v a t e - B r a n c h : r e n o v a t e \/ d e p e n d e n c y - 1 \. x \n C h a n g e - I d : I [ a - z 0 - 9 ] { 40 } $ / ,
497- ) ,
498- ] ,
499- prTitle : 'pr title' ,
500- autoApprove : true ,
501- force : true ,
502- labels : [ 'hashtag1' , 'hashtag2' ] ,
503- } ) ;
504- // For new changes, push should NOT be called - it will be done by createPr()
505- expect ( git . pushCommit ) . not . toHaveBeenCalled ( ) ;
506- } ) ;
507-
508- it ( 'commitFiles() - existing change-set with new changes - ensure labels' , async ( ) => {
434+ it ( 'commitAndPush() - existing change with new changes - ensure labels' , async ( ) => {
509435 const existingChange = partial < GerritChange > ( {
510436 _number : 123456 ,
511437 change_id : '...' ,
0 commit comments