MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestFeatureFlagError

Function TestFeatureFlagError

pkg/inventory/registry_test.go:1147–1161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1145}
1146
1147func TestFeatureFlagError(t *testing.T) {
1148 tools := []ServerTool{
1149 mockToolWithFlags("needs_flag", "toolset1", true, "my_feature", ""),
1150 }
1151
1152 // Checker that returns error should treat as false (tool excluded)
1153 checkerError := func(_ context.Context, _ string) (bool, error) {
1154 return false, fmt.Errorf("simulated error")
1155 }
1156 reg := mustBuild(t, NewBuilder().SetTools(tools).WithFeatureChecker(checkerError))
1157 available := reg.AvailableTools(context.Background())
1158 if len(available) != 0 {
1159 t.Errorf("Expected 0 tools when checker errors, got %d", len(available))
1160 }
1161}
1162
1163func TestFeatureFlagResources(t *testing.T) {
1164 resources := []ServerResourceTemplate{

Callers

nothing calls this directly

Calls 6

mockToolWithFlagsFunction · 0.85
mustBuildFunction · 0.85
NewBuilderFunction · 0.85
WithFeatureCheckerMethod · 0.80
SetToolsMethod · 0.80
AvailableToolsMethod · 0.80

Tested by

no test coverage detected