package knowledge

import "testing"

func TestPreserveNodeSelectionByLabel(t *testing.T) {
	previous := []Node{
		{ID: "old-1", Label: "化療後 皮膚乾", SelectedForScan: true},
		{ID: "old-2", Label: "無關節點", SelectedForScan: false},
	}
	nodes := []Node{
		{ID: "new-1", Label: "化療後 皮膚乾"},
		{ID: "new-2", Label: "新痛點"},
	}
	PreserveNodeSelectionByLabel(nodes, previous)
	if !nodes[0].SelectedForScan {
		t.Fatal("expected first node selection to be preserved by label")
	}
	if nodes[1].SelectedForScan {
		t.Fatal("expected unrelated node to stay unselected")
	}
}
