thread-master/backend/internal/library/copymission/research_items_test.go

29 lines
708 B
Go
Raw Normal View History

2026-06-28 08:28:42 +00:00
package copymission
import (
"strings"
"testing"
)
func TestMergeReferenceURLsIncludesResearchItems(t *testing.T) {
urls := MergeReferenceURLs(
[]string{"https://example.com/a"},
[]ResearchSource{
{URL: "https://example.com/b", Title: "B"},
{URL: "https://example.com/a", Title: "dup"},
},
)
if len(urls) != 2 {
t.Fatalf("urls = %v", urls)
}
}
func TestFormatResearchItemsForMatrix(t *testing.T) {
block := FormatResearchItemsForMatrix([]ResearchSource{
{Title: "備孕指南", URL: "https://example.com/guide", Snippet: "葉酸補充重點"},
})
if !strings.Contains(block, "備孕指南") || !strings.Contains(block, "葉酸補充重點") {
t.Fatalf("block = %q", block)
}
}