diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index cb0a129a1..096f1b60d 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -400,3 +400,19 @@ func TestResolveReferenceURL(t *testing.T) { t.Errorf("%s", chartURL) } } + +func TestEntry_URLWithTrailingSlash(t *testing.T) { + urlWithTrailingSlash := "http://someserver/something/" + e := Entry{URL: urlWithTrailingSlash} + + if e.URLWithTrailingSlash() != urlWithTrailingSlash { + t.Errorf("Expected unchanged repository URL") + } + + urlWithoutTrailingSlash := strings.TrimSuffix(urlWithTrailingSlash, "/") + e = Entry{URL: urlWithoutTrailingSlash} + + if e.URLWithTrailingSlash() != urlWithTrailingSlash { + t.Errorf("Expected repository URL without trailing slash") + } +}