friendica-exporter/serverinfo/url_test.go

32 lines
583 B
Go
Raw Normal View History

2024-10-24 20:26:41 +02:00
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)
}
})
}
}