map nyaa://q=X to https://nyaa.si/.../
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user