friendica-exporter/serverinfo/url_test.go
2024-10-27 19:51:26 +01:00

31 lines
583 B
Go

package serverinfo
import "testing"
func TestStatsURL(t *testing.T) {
tt := []struct {
desc string
serverURL string
statsKey string
wantURL string
}{
{
desc: "normal",
serverURL: "https://friendica.example.com",
statsKey: "234/%&/%&/!",
wantURL: "https://friendica.example.com/stats?key=234/%&/%&/!",
},
}
for _, tc := range tt {
tc := tc
t.Run(tc.desc, func(t *testing.T) {
t.Parallel()
url := StatsURL(tc.serverURL, tc.statsKey)
if url != tc.wantURL {
t.Errorf("got url %q, want %q", url, tc.wantURL)
}
})
}
}