package pipeline

import (
	"testing"

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

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

	tests := []struct {
		name string
		src  string
		want MCPSurfaceResult
	}{
		{
			name: "runtime walker",
			src:  "// Generated by CLI Printing Press. DO NOT EDIT.\nfunc RegisterTools(){ cobratree.RegisterAll(s, root, path) }",
			want: MCPSurfaceResult{State: MCPSurfaceRuntime, Pass: true, Detail: "MCP surface mirrors the Cobra tree at runtime"},
		},
		{
			name: "static list",
			src:  "// Generated by CLI Printing Press. DO NOT EDIT.\nfunc RegisterNovelFeatureTools(){ shellOutToCLI(\"stale\") }",
			want: MCPSurfaceResult{State: MCPSurfaceStaticList, Pass: false, Detail: "static novel-feature MCP list detected; run `cli-printing-press mcp-sync <cli-dir>`"},
		},
		{
			name: "hand edited",
			src:  "package mcp\nfunc RegisterTools(){}",
			want: MCPSurfaceResult{State: MCPSurfaceHandEdited, Pass: true, HandEdited: true, Detail: "tools.go appears hand-edited; mcp-sync will not overwrite it without --force"},
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			t.Parallel()
			assert.Equal(t, tt.want, ClassifyMCPSurface(tt.src))
		})
	}
}
