Add tests for Entry.URLWithTrailingSlash

Signed-off-by: Dominik Braun <mail@dominikbraun.io>
pull/9095/head
Dominik Braun 5 years ago
parent 3cde12ce9b
commit f234d15730

@ -400,3 +400,19 @@ func TestResolveReferenceURL(t *testing.T) {
t.Errorf("%s", chartURL) 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")
}
}

Loading…
Cancel
Save