File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,17 @@ class ScmRouter extends Scm {
257257 return this . chooseScm ( config ) . then ( scm => scm . getCommitSha ( config ) ) ;
258258 }
259259
260+ /**
261+ * Add a comment on a pull request
262+ * @method _addPrComment
263+ * @param {Object } config Configuration
264+ * @param {String } config.scmContext Name of scm context
265+ * @return {Promise }
266+ */
267+ _addPrComment ( config ) {
268+ return this . chooseScm ( config ) . then ( scm => scm . addPrComment ( config ) ) ;
269+ }
270+
260271 /**
261272 * Update the commit status for a given repo and sha
262273 * @method _updateCommitStatus
Original file line number Diff line number Diff line change 4343 },
4444 "dependencies" : {
4545 "async" : " ^2.6.1" ,
46- "screwdriver-scm-base" : " ^4.4.3 "
46+ "screwdriver-scm-base" : " ^5.0.0 "
4747 },
4848 "release" : {
4949 "debug" : false ,
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ describe('index test', () => {
4646 'getPermissions' ,
4747 'getOrgPermissions' ,
4848 'getCommitSha' ,
49+ 'addPrComment' ,
4950 'updateCommitStatus' ,
5051 'getFile' ,
5152 'getChangedFiles' ,
@@ -730,6 +731,25 @@ describe('index test', () => {
730731 } ) ;
731732 } ) ;
732733
734+ describe ( '_addPrComment' , ( ) => {
735+ const config = { scmContext : 'example.context' } ;
736+
737+ it ( 'call origin addPrComment' , ( ) => {
738+ const scmGithub = scm . scms [ 'github.context' ] ;
739+ const exampleScm = scm . scms [ 'example.context' ] ;
740+ const scmGitlab = scm . scms [ 'gitlab.context' ] ;
741+
742+ return scm . _addPrComment ( config )
743+ . then ( ( result ) => {
744+ assert . strictEqual ( result , 'example' ) ;
745+ assert . notCalled ( scmGithub . addPrComment ) ;
746+ assert . notCalled ( scmGitlab . addPrComment ) ;
747+ assert . calledOnce ( exampleScm . addPrComment ) ;
748+ assert . calledWith ( exampleScm . addPrComment , config ) ;
749+ } ) ;
750+ } ) ;
751+ } ) ;
752+
733753 describe ( '_updateCommitStatus' , ( ) => {
734754 const config = { scmContext : 'example.context' } ;
735755
You can’t perform that action at this time.
0 commit comments