Skip to content

Commit

Permalink
test: add GetAbsoluteLocator test
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Nov 29, 2024
1 parent 623fbfb commit f30d535
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,17 @@ func TestGetAbsoluteLocator_AbsoluteLocatorIsInRootPackageButSourceIsNotShouldNo
require.Nil(t, err)
}

func TestGetAbsoluteLocator_RepositoriesWithSamePrefixNameShouldNotBeBlocked(t *testing.T) {
provider := NewGitPackageContentProvider("", "", NewGitHubPackageAuthProvider(""), nil)

packageId := "github.com/main-package"
locatorOfModuleInWhichThisBuiltInIsBeingCalled := "github.com/main-package-xyz/main.star" // same package prefix
maybeRelativeLocator := "github.com/main-package/file.star"

_, err := provider.GetAbsoluteLocator(packageId, locatorOfModuleInWhichThisBuiltInIsBeingCalled, maybeRelativeLocator, noPackageReplaceOptions)
require.Nil(t, err)
}

func Test_isSamePackageLocalAbsoluteLocator_TestDetectionInSubpath(t *testing.T) {
result := shouldBlockAbsoluteLocatorBecauseIsInTheSameSourceModuleLocatorPackage("github.com/author/package/bang/lib.star", "github.com/author/package/main.star", "github.com/author/package/")
require.True(t, result)
Expand Down

0 comments on commit f30d535

Please sign in to comment.