项目文件夹

文件
wehub-resource-sync a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

28 行
1012 B
Go

package mcp
import (
"testing"
"github.com/stretchr/testify/require"
)
// TestIndexHealth_SurfacesToolPreset: the tool-surface state (active preset
// + learned-promotion count) rides on index_health so the policy is
// inspectable without a separate call.
func TestIndexHealth_SurfacesToolPreset(t *testing.T) {
srv := setupPresetServer(t, ToolPolicyConfig{Preset: "agent", Mode: "defer"})
payload := srv.buildIndexHealthPayload()
require.Equal(t, "agent", payload["tool_preset"])
require.Equal(t, "defer", payload["tool_preset_mode"])
// No learned promotions yet on a fresh server → the key is omitted.
_, hasLearned := payload["learned_tools"]
require.False(t, hasLearned)
// After a learned promotion, the count + names surface.
srv.InitLearnedTools(t.TempDir(), t.TempDir())
srv.RecordLearnedPromotion("get_architecture", "")
payload = srv.buildIndexHealthPayload()
require.Equal(t, 1, payload["learned_tools"])
require.Contains(t, payload["learned_tool_names"], "get_architecture")
}