package pipeline

import (
	"reflect"
	"testing"

	"gitea.maximumdirect.net/eric/notarius/internal/core/artifacts"
)

func TestMergeLLMProfileManifestsDistinguishesEffectiveTargets(t *testing.T) {
	got := mergeLLMProfileManifests(
		[]artifacts.LLMProfileManifest{
			{ID: "profile", Provider: "promptkit", Model: "model", BackendID: "backend-b", ReasoningEffort: "low"},
			{ID: " profile ", Provider: " promptkit ", Model: " model ", BackendID: " backend-a ", ReasoningEffort: " low "},
		},
		[]artifacts.LLMProfileManifest{
			{ID: "profile", Provider: "promptkit", Model: "model", BackendID: "backend-a", ReasoningEffort: "high"},
			{ID: "profile", Provider: "promptkit", Model: "model", BackendID: "backend-a", ReasoningEffort: "low"},
		},
	)
	want := []artifacts.LLMProfileManifest{
		{ID: "profile", Provider: "promptkit", Model: "model", BackendID: "backend-a", ReasoningEffort: "high"},
		{ID: "profile", Provider: "promptkit", Model: "model", BackendID: "backend-a", ReasoningEffort: "low"},
		{ID: "profile", Provider: "promptkit", Model: "model", BackendID: "backend-b", ReasoningEffort: "low"},
	}
	if !reflect.DeepEqual(got, want) {
		t.Fatalf("merged profiles = %#v, want %#v", got, want)
	}
}
