Some checks failed
CI pipeline for ffd-indexer / checks (go test + golangci) (push) Failing after 26s
CI pipeline for ffd-indexer / build binaries + containers (push) Failing after 3s
CI pipeline for ffd-indexer / format (gofmt + nixfmt) (push) Failing after 3s
CI pipeline for ffd-indexer / integration (live scrape + Typesense) (push) Failing after 20s
24 lines
639 B
Go
24 lines
639 B
Go
package scraper
|
|
|
|
import "testing"
|
|
|
|
func TestScheme(t *testing.T) {
|
|
tests := []struct {
|
|
in string
|
|
scheme string
|
|
fqdn string
|
|
}{
|
|
{"git.example.org", "https", "git.example.org"},
|
|
{"https://git.example.org", "https", "git.example.org"},
|
|
{"http://git.example.org", "http", "git.example.org"},
|
|
{"https://git.example.org/", "https", "git.example.org"},
|
|
{"http://git.example.net", "http", "git.example.net"},
|
|
}
|
|
for _, tt := range tests {
|
|
scheme, fqdn := Scheme(tt.in)
|
|
if scheme != tt.scheme || fqdn != tt.fqdn {
|
|
t.Errorf("Scheme(%q) = (%q, %q), want (%q, %q)",
|
|
tt.in, scheme, fqdn, tt.scheme, tt.fqdn)
|
|
}
|
|
}
|
|
}
|