MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestSearchAPIByServiceNotFound

Function TestSearchAPIByServiceNotFound

backend/api/mcp/tool_search_test.go:53–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestSearchAPIByServiceNotFound(t *testing.T) {
54 profile := &config.Profile{Mode: common.ReleaseModeDev}
55 s, err := NewServer(nil, profile, "test-secret")
56 require.NoError(t, err)
57
58 // Test browsing a non-existent service
59 result, _, err := s.handleSearchAPI(context.Background(), nil, SearchInput{
60 Service: "NonExistentService",
61 })
62 require.NoError(t, err)
63 require.NotNil(t, result)
64 require.Len(t, result.Content, 1)
65
66 text := result.Content[0].(*mcpsdk.TextContent).Text
67 require.Contains(t, text, "No endpoints found")
68 require.Contains(t, text, "Available services")
69}
70
71func TestSearchAPIDetailMode(t *testing.T) {
72 profile := &config.Profile{Mode: common.ReleaseModeDev}

Callers

nothing calls this directly

Calls 3

handleSearchAPIMethod · 0.95
LenMethod · 0.80
NewServerFunction · 0.70

Tested by

no test coverage detected