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)
	}
}