MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / expectServerBranding

Function expectServerBranding

__tests__/mcp-initialize.test.ts:26–36  ·  view source on GitHub ↗

The fields of `serverInfo` a host can draw.

(info: { title?: string; icons?: Array<Record<string, unknown>> })

Source from the content-addressed store, hash-verified

24
25/** The fields of `serverInfo` a host can draw. */
26function expectServerBranding(info: { title?: string; icons?: Array<Record<string, unknown>> }): void {
27 expect(info.title).toBe('CodeGraph');
28 expect(info.icons).toHaveLength(1);
29 const icon = info.icons![0]!;
30 expect(icon.mimeType).toBe('image/svg+xml');
31 expect(String(icon.src)).toMatch(/^data:image\/svg\+xml;base64,/);
32 const svg = Buffer.from(String(icon.src).split(',')[1]!, 'base64').toString('utf8');
33 expect(svg).toMatch(/^<svg\b/);
34 // `sizes` is left off on purpose: see SERVER_INFO.
35 expect(Object.keys(icon).sort()).toEqual(['mimeType', 'src']);
36}
37
38function spawnServer(cwd: string): ChildProcessWithoutNullStreams {
39 return spawn(process.execPath, [...WASM_RUNTIME_FLAGS, BIN, 'serve', '--mcp'], {

Callers 1

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected