@@ -15,8 +15,6 @@ import (
1515 "github.com/CycloneDX/cyclonedx-go"
1616 "github.com/google/go-github/v45/github"
1717 biutils "github.com/jfrog/build-info-go/utils"
18- "github.com/jfrog/frogbot/v2/utils"
19- "github.com/jfrog/frogbot/v2/utils/outputwriter"
2018 "github.com/jfrog/froggit-go/vcsclient"
2119 "github.com/jfrog/froggit-go/vcsutils"
2220 "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
@@ -31,6 +29,9 @@ import (
3129 "github.com/jfrog/jfrog-client-go/xray/services"
3230 "github.com/stretchr/testify/assert"
3331 "github.com/stretchr/testify/require"
32+
33+ "github.com/jfrog/frogbot/v2/utils"
34+ "github.com/jfrog/frogbot/v2/utils/outputwriter"
3435)
3536
3637const rootTestDir = "scanrepository"
@@ -392,16 +393,20 @@ func TestGenerateFixBranchName(t *testing.T) {
392393 baseBranch string
393394 impactedPackage string
394395 fixVersion string
396+ projectPath string
395397 expectedName string
396398 }{
397- {"dev" , "gopkg.in/yaml.v3" , "3.0.0" , "frogbot-gopkg.in/yaml.v3-d61bde82dc594e5ccc5a042fe224bf7c" },
398- {"master" , "gopkg.in/yaml.v3" , "3.0.0" , "frogbot-gopkg.in/yaml.v3-41405528994061bd108e3bbd4c039a03" },
399- {"dev" , "replace:colons:colons" , "3.0.0" , "frogbot-replace_colons_colons-89e555131b4a70a32fe9d9c44d6ff0fc" },
399+ {"dev" , "gopkg.in/yaml.v3" , "3.0.0" , "" , "frogbot-gopkg.in/yaml.v3-d61bde82dc594e5ccc5a042fe224bf7c" },
400+ {"master" , "gopkg.in/yaml.v3" , "3.0.0" , "" , "frogbot-gopkg.in/yaml.v3-41405528994061bd108e3bbd4c039a03" },
401+ {"dev" , "replace:colons:colons" , "3.0.0" , "" , "frogbot-replace_colons_colons-89e555131b4a70a32fe9d9c44d6ff0fc" },
402+ {"main" , "requests" , "2.25.3" , "" , "frogbot-requests-ae6fef399c0fdd96441b0215f28147d2" },
403+ {"main" , "requests" , "2.25.3" , "subfolder" , "frogbot-requests-28662794aa63a6250dd9a80f7618f841" },
404+ {"main" , "requests" , "2.25.3" , "other/project" , "frogbot-requests-61eeddf6eda4b867a2b75fa5630875e8" },
400405 }
401406 gitManager := utils.GitManager {}
402407 for _ , test := range tests {
403408 t .Run (test .expectedName , func (t * testing.T ) {
404- branchName , err := gitManager .GenerateFixBranchName (test .baseBranch , test .impactedPackage , test .fixVersion )
409+ branchName , err := gitManager .GenerateFixBranchName (test .baseBranch , test .impactedPackage , test .fixVersion , test . projectPath )
405410 assert .NoError (t , err )
406411 assert .Equal (t , test .expectedName , branchName )
407412 })
0 commit comments