fix: load real discover posters

This commit is contained in:
ShukeBta
2026-06-24 21:30:44 +08:00
parent 9bdf1a73e7
commit dd3d4c1aec
7 changed files with 90 additions and 11 deletions
+18
View File
@@ -0,0 +1,18 @@
package service
import "testing"
func TestNormalizeBangumiImageURLUsesHTTPSResizedCover(t *testing.T) {
got := normalizeBangumiImageURL("http://lain.bgm.tv/pic/cover/l/27/ff/377130_wDU1x.jpg")
want := "https://lain.bgm.tv/r/400/pic/cover/l/27/ff/377130_wDU1x.jpg"
if got != want {
t.Fatalf("url = %q, want %q", got, want)
}
}
func TestNormalizeBangumiImageURLLeavesExternalHostsAlone(t *testing.T) {
raw := "https://image.tmdb.org/t/p/w500/poster.jpg"
if got := normalizeBangumiImageURL(raw); got != raw {
t.Fatalf("url = %q, want %q", got, raw)
}
}