Files
2026-06-23 05:02:15 +08:00

25 lines
556 B
Go

package gitea_test
import (
"testing"
"superwork-tui/internal/gitea"
)
func TestNewNormalizesHost(t *testing.T) {
cases := []struct {
in string
want string
}{
{"gitea.example.cn", "https://gitea.example.cn"},
{"https://gitea.example.cn", "https://gitea.example.cn"},
{"https://gitea.example.cn/", "https://gitea.example.cn"},
{"http://localhost:3000", "http://localhost:3000"},
}
for _, c := range cases {
if got := gitea.New(c.in, "tok").Host; got != c.want {
t.Errorf("New(%q).Host = %q, want %q", c.in, got, c.want)
}
}
}