Skip to content

Commit

Permalink
test: import package with same prefix name
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Nov 29, 2024
1 parent 66987d9 commit 623fbfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ func Test_isSamePackageLocalAbsoluteLocator_TestDetectionInDifferentSubdirectori
require.True(t, result)
}

func Test_isNotSamePackageLocalAbsoluteLocator_TestRepositoriesWithSamePrefixNames(t *testing.T) {
result := shouldBlockAbsoluteLocatorBecauseIsInTheSameSourceModuleLocatorPackage("github.com/author/package2/main.star", "github.com/author/package/main.star", "github.com/author/package/")
require.False(t, result)
}

func Test_getPathToPackageRoot(t *testing.T) {
githubUrlWithKurtosisPackageInSubfolder := "github.com/sample/sample-package/folder/subpackage"
parsedGitUrl, err := shared_utils.ParseGitURL(githubUrlWithKurtosisPackageInSubfolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ func isLocalLocator(locator string) bool {
}

func shouldBlockAbsoluteLocatorBecauseIsInTheSameSourceModuleLocatorPackage(relativeOrAbsoluteLocator string, sourceModuleLocator string, rootPackageId string) bool {

isSourceModuleInRootPackage := strings.HasPrefix(sourceModuleLocator, rootPackageId)
isAbsoluteLocatorInRootPackage := strings.HasPrefix(relativeOrAbsoluteLocator, rootPackageId)

return isSourceModuleInRootPackage && isAbsoluteLocatorInRootPackage
}

Expand Down

0 comments on commit 623fbfb

Please sign in to comment.