mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-28 11:16:37 +08:00
19 lines
564 B
Go
19 lines
564 B
Go
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)
|
|
}
|
|
}
|