Files
Containr/app/backend/internal/cli/commands/auth_test.go
T
2026-04-10 12:02:36 +02:00

22 lines
504 B
Go

package commands
import (
"testing"
"github.com/spf13/viper"
)
func TestBuildAPIURLDefaultsAndTrimming(t *testing.T) {
viper.Set("api-url", "")
got := buildAPIURL("/user/profile")
if got != "http://localhost:8080/api/v1/user/profile" {
t.Fatalf("unexpected default api url: %s", got)
}
viper.Set("api-url", "https://api.example.com/api/v1/")
got = buildAPIURL("user/profile")
if got != "https://api.example.com/api/v1/user/profile" {
t.Fatalf("unexpected trimmed api url: %s", got)
}
}