package copymission

import (
	"testing"

	libkg "haixun-backend/internal/library/knowledge"
)

func TestReferenceURLsFromSelection(t *testing.T) {
	nodes := []libkg.Node{
		{
			ID:              "n1",
			SelectedForScan: true,
			Evidence: []libkg.Evidence{
				{URL: "https://example.com/a"},
			},
		},
		{
			ID:              "n2",
			SelectedForScan: false,
			Evidence: []libkg.Evidence{
				{URL: "https://example.com/b"},
			},
		},
	}
	sources := []libkg.BraveSource{
		{URL: "https://example.com/a"},
		{URL: "https://example.com/c"},
	}
	urls := ReferenceURLsFromSelection(nodes, sources)
	if len(urls) != 1 || urls[0] != "https://example.com/a" {
		t.Fatalf("urls = %v", urls)
	}
}