This commit is contained in:
bel
2025-05-04 10:34:03 -06:00
parent 32a010e697
commit 0399fc9316
2 changed files with 56 additions and 1 deletions

View File

@@ -74,3 +74,24 @@ func TestFeedFetch(t *testing.T) {
t.Errorf("expected\n\t%+v but got \n\t%+v", expect, items[0])
}
}
func TestFeedFetchURL(t *testing.T) {
cases := map[string]string{
"http://host/path?k=v": "http://host/path?k=v",
"https://host/path?k=v": "https://host/path?k=v",
"nyaa://?q=a b&u=c d": "https://nyaa.si/?c=0_0&f=0&page=rss&q=a+b&u=c+d",
}
for given, want := range cases {
given := given
want := want
t.Run(given, func(t *testing.T) {
f := feeds.Feed{}
f.Version.URL = given
got, _ := f.FetchURL()
if got := got.String(); got != want {
t.Errorf("expected %q but got %q", want, got)
}
})
}
}