package bgtask

import (
	"testing"

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

func TestGetComponentNode(t *testing.T) {
	tests := []struct {
		name          string
		componentNode string
		expected      string
	}{
		{
			name:          "configured node group",
			componentNode: "manus-import-2xl",
			expected:      "manus-import-2xl",
		},
		{
			name:     "missing config falls back to general",
			expected: bgtaskComponentNode,
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			h := &handler{
				componentNode: tt.componentNode,
			}

			require.Equal(t, tt.expected, h.getComponentNode())
		})
	}
}
