32 lines
583 B
Go
32 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)
|
|
}
|
|
})
|
|
}
|
|
}
|