@@ -51,7 +51,7 @@ describe(".isPR", () => {
51
51
expect ( codebuild . isPR ) . toBeFalsy ( )
52
52
} )
53
53
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 ) => {
55
55
const copiedEnv = { ...correctEnv }
56
56
delete copiedEnv [ key ]
57
57
const codebuild = await setupCodeBuildSource ( copiedEnv )
@@ -71,7 +71,7 @@ describe(".pullRequestID", () => {
71
71
jest . resetAllMocks ( )
72
72
} )
73
73
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 ) => {
75
75
const codebuild = await setupCodeBuildSource ( { [ key ] : "pr/2" } )
76
76
await codebuild . setup ( )
77
77
expect ( codebuild . pullRequestID ) . toEqual ( "2" )
@@ -90,6 +90,18 @@ describe(".pullRequestID", () => {
90
90
expect ( getPullRequestIDForBranch ) . toHaveBeenCalledWith ( codebuild , env , "my-branch" )
91
91
} )
92
92
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
+
93
105
it ( "does not call the API if no PR number or branch name available in the env vars" , async ( ) => {
94
106
const env = {
95
107
CODEBUILD_SOURCE_REPO_URL : "https://github.com/sharkysharks/some-repo" ,
0 commit comments