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

Function TestBuildInitializedNotification

cmd/mcpcurl/main_test.go:156–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

154}
155
156func TestBuildInitializedNotification(t *testing.T) {
157 t.Parallel()
158 got := buildInitializedNotification()
159
160 var msg map[string]json.RawMessage
161 if err := json.Unmarshal([]byte(got), &msg); err != nil {
162 t.Fatalf("result is not valid JSON: %v", err)
163 }
164
165 // Must have jsonrpc and method
166 var method string
167 if err := json.Unmarshal(msg["method"], &method); err != nil {
168 t.Fatalf("failed to parse method: %v", err)
169 }
170 if method != "notifications/initialized" {
171 t.Errorf("expected method 'notifications/initialized', got %q", method)
172 }
173
174 // Must NOT have an id (it's a notification)
175 if _, hasID := msg["id"]; hasID {
176 t.Error("notification should not have an 'id' field")
177 }
178}

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected