// Copyright 2026 Cisco Systems, Inc. and its affiliates
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

package tui

import (
	"strings"
	"testing"
)

func TestFriendlyConnectorNameCoversHookSurfaceConnectors(t *testing.T) {
	t.Parallel()
	cases := map[string]string{
		"hermes":    "Hermes",
		"cursor":    "Cursor",
		"windsurf":  "Windsurf",
		"geminicli": "Gemini CLI",
		"copilot":   "GitHub Copilot CLI",
	}
	for wire, want := range cases {
		if got := FriendlyConnectorName(wire); got != want {
			t.Fatalf("FriendlyConnectorName(%q) = %q, want %q", wire, got, want)
		}
	}
}

func TestConnectorSourceLabelCoversHookSurfaceConnectors(t *testing.T) {
	t.Parallel()
	cases := []struct {
		connector string
		category  string
		want      string
	}{
		{"hermes", "mcps", ".hermes/config.yaml"},
		{"cursor", "skills", ".cursor/skills"},
		{"windsurf", "config", ".codeium/windsurf/hooks.json"},
		{"geminicli", "plugins", ".gemini/extensions"},
		{"copilot", "mcps", ".github/mcp.json"},
	}
	for _, tc := range cases {
		tc := tc
		t.Run(tc.connector+"_"+tc.category, func(t *testing.T) {
			t.Parallel()
			got := ConnectorSourceLabel(tc.connector, tc.category)
			if !strings.Contains(got, tc.want) {
				t.Fatalf("ConnectorSourceLabel(%q, %q) = %q, want substring %q",
					tc.connector, tc.category, got, tc.want)
			}
		})
	}
}
