11
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user