mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-19 16:54:15 +00:00
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
package labeler
|
|
|
|
import "testing"
|
|
|
|
func TestConfig_PublicURL(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
baseURL string
|
|
want string
|
|
}{
|
|
{"standard", "https://atcr.io", "https://labeler.atcr.io"},
|
|
{"with port", "https://atcr.io:8080", "https://labeler.atcr.io:8080"},
|
|
{"localhost", "http://localhost:5000", "http://labeler.localhost:5000"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
cfg := &Config{
|
|
Server: AppviewServerConfig{BaseURL: tt.baseURL},
|
|
}
|
|
got := cfg.PublicURL()
|
|
if got != tt.want {
|
|
t.Errorf("PublicURL() = %q, want %q", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestConfig_DID(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
baseURL string
|
|
want string
|
|
}{
|
|
{"standard", "https://atcr.io", "did:web:labeler.atcr.io"},
|
|
{"with port", "https://atcr.io:8080", "did:web:labeler.atcr.io%3A8080"},
|
|
{"localhost", "http://localhost:5000", "did:web:labeler.localhost%3A5000"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
cfg := &Config{
|
|
Server: AppviewServerConfig{BaseURL: tt.baseURL},
|
|
}
|
|
got := cfg.DID()
|
|
if got != tt.want {
|
|
t.Errorf("DID() = %q, want %q", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|