The fields of `serverInfo` a host can draw.
(info: { title?: string; icons?: Array<Record<string, unknown>> })
| 24 | |
| 25 | /** The fields of `serverInfo` a host can draw. */ |
| 26 | function 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 | |
| 38 | function spawnServer(cwd: string): ChildProcessWithoutNullStreams { |
| 39 | return spawn(process.execPath, [...WASM_RUNTIME_FLAGS, BIN, 'serve', '--mcp'], { |
no test coverage detected