(body: string)
| 29 | } |
| 30 | |
| 31 | function parseSse(body: string): Array<StreamEvent> { |
| 32 | const events: Array<StreamEvent> = [] |
| 33 | for (const line of body.split('\n')) { |
| 34 | const trimmed = line.trim() |
| 35 | if (!trimmed.startsWith('data:')) continue |
| 36 | const json = trimmed.slice('data:'.length).trim() |
| 37 | if (!json) continue |
| 38 | try { |
| 39 | events.push(JSON.parse(json) as StreamEvent) |
| 40 | } catch { |
| 41 | // Ignore non-JSON keepalive lines. |
| 42 | } |
| 43 | } |
| 44 | return events |
| 45 | } |
| 46 | |
| 47 | test.describe('mcp-managed — chat({ mcp }) discovery + lifecycle', () => { |
| 48 | test('chat({ mcp }) discovers get_guitar_price and the result reaches the transcript', async ({ |
no test coverage detected