Harden preview enrichment and recommendation metadata
build-push / docker (push) Has been cancelled

This commit is contained in:
AI Assistant
2026-03-16 16:39:09 +09:00
parent 93b9f571ab
commit 2064825d29
7 changed files with 433 additions and 106 deletions
+25
View File
@@ -44,6 +44,15 @@ func TestExtractEnvatoPreviewFromHydration(t *testing.T) {
}
}
func TestCollectEnvatoPreviewURLFindsOgVideo(t *testing.T) {
html := `<meta property="og:video" content="https://video-previews.elements.envatousercontent.com/example/watermarked_preview/watermarked_preview.mp4">`
got := collectEnvatoPreviewURL(html, "", "", "")
want := "https://video-previews.elements.envatousercontent.com/example/watermarked_preview/watermarked_preview.mp4"
if got != want {
t.Fatalf("expected %q, got %q", want, got)
}
}
func TestIsUsefulGoogleVideoResultRejectsMusicResults(t *testing.T) {
result := SearchResult{
Title: "Couple Friendly Sad Bgm Movie Best Bgm",
@@ -109,6 +118,22 @@ func TestIsMatchingArtgridClipPageRejectsHomepage(t *testing.T) {
}
}
func TestIsMatchingArtgridClipPageAcceptsBodySignals(t *testing.T) {
html := `<html><head><title>Night City | Stock Video Footage - Artgrid.io</title></head><body><script>window.__clip="6600269";</script></body></html>`
if !isMatchingArtgridClipPage(html, "6600269") {
t.Fatal("expected body/title signal Artgrid HTML to be accepted")
}
}
func TestLowValueThumbnailDetection(t *testing.T) {
if !IsLowValueThumbnail("https://example.com/favicon.ico") {
t.Fatal("expected favicon to be low-value thumbnail")
}
if IsLowValueThumbnail("https://i.ytimg.com/vi/abcd1234xyz/hqdefault.jpg") {
t.Fatal("expected youtube thumbnail to be usable")
}
}
func TestGeminiCandidateLimitNeverExceedsCandidates(t *testing.T) {
if got := GeminiCandidateLimit(9); got != 9 {
t.Fatalf("expected Gemini limit to stay within candidate count, got %d", got)