package taskboard

import (
	"context"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestNormalizeTasksWithTaxonomySkipsCatalogLoadForProjectedOptionFields(t *testing.T) {
	t.Parallel()

	queryer := &scriptedTaskboardQueryExecer{}
	tasks := []Task{
		{
			ID: "tsk-1",
			KindField: &TaskFieldValue{
				OptionID: "opt-kind",
				Key:      "feature",
				Label:    "Feature",
			},
			PriorityField: &TaskFieldValue{
				OptionID: "opt-priority",
				Key:      "p1",
				Label:    "High",
			},
		},
	}

	normalized, err := (TxStore{}).normalizeTasksWithTaxonomy(context.Background(), queryer, "wsp-1", tasks)
	require.NoError(t, err)
	require.Equal(t, "Feature", normalized[0].Kind)
	require.Equal(t, "High", normalized[0].Priority)
	require.Empty(t, queryer.queries, "task browse/detail rows already joined option labels and must not query or write taxonomy defaults")
}
