@@ -51,7 +51,7 @@ describe(".isPR", () => {
5151 expect ( codebuild . isPR ) . toBeFalsy ( )
5252 } )
5353
54- it . each ( [ "CODEBUILD_BUILD_ID" , "CODEBUILD_SOURCE_REPO_URL" ] ) ( `does not validate when %s is missing` , async key => {
54+ it . each ( [ "CODEBUILD_BUILD_ID" , "CODEBUILD_SOURCE_REPO_URL" ] ) ( `does not validate when %s is missing` , async ( key ) => {
5555 const copiedEnv = { ...correctEnv }
5656 delete copiedEnv [ key ]
5757 const codebuild = await setupCodeBuildSource ( copiedEnv )
@@ -71,7 +71,7 @@ describe(".pullRequestID", () => {
7171 jest . resetAllMocks ( )
7272 } )
7373
74- it . each ( [ "CODEBUILD_SOURCE_VERSION" , "CODEBUILD_WEBHOOK_TRIGGER" ] ) ( "splits it from %s" , async key => {
74+ it . each ( [ "CODEBUILD_SOURCE_VERSION" , "CODEBUILD_WEBHOOK_TRIGGER" ] ) ( "splits it from %s" , async ( key ) => {
7575 const codebuild = await setupCodeBuildSource ( { [ key ] : "pr/2" } )
7676 await codebuild . setup ( )
7777 expect ( codebuild . pullRequestID ) . toEqual ( "2" )
@@ -90,6 +90,18 @@ describe(".pullRequestID", () => {
9090 expect ( getPullRequestIDForBranch ) . toHaveBeenCalledWith ( codebuild , env , "my-branch" )
9191 } )
9292
93+ it ( 'allows for branch names with "/" in them' , async ( ) => {
94+ const env = {
95+ CODEBUILD_SOURCE_REPO_URL : "https://github.com/sharkysharks/some-repo" ,
96+ CODEBUILD_WEBHOOK_TRIGGER : "branch/my-branch/with/slashes" ,
97+ DANGER_GITHUB_API_TOKEN : "xxx" ,
98+ }
99+ const codebuild = await setupCodeBuildSource ( env )
100+ expect ( codebuild . pullRequestID ) . toBe ( "0" )
101+ expect ( getPullRequestIDForBranch ) . toHaveBeenCalledTimes ( 1 )
102+ expect ( getPullRequestIDForBranch ) . toHaveBeenCalledWith ( codebuild , env , "my-branch/with/slashes" )
103+ } )
104+
93105 it ( "does not call the API if no PR number or branch name available in the env vars" , async ( ) => {
94106 const env = {
95107 CODEBUILD_SOURCE_REPO_URL : "https://github.com/sharkysharks/some-repo" ,
0 commit comments