(lines: string[])
| 7 | |
| 8 | // Helper function to normalize stream data for comparison |
| 9 | function normalizeStreamData(lines: string[]): string[] { |
| 10 | return lines.map((line) => { |
| 11 | if (line.startsWith('data: ')) { |
| 12 | try { |
| 13 | const data = JSON.parse(line.slice(6)); // Remove 'data: ' prefix |
| 14 | if (data.id) { |
| 15 | // Replace dynamic id with a static one for comparison |
| 16 | return `data: ${JSON.stringify({ ...data, id: 'STATIC_ID' })}`; |
| 17 | } |
| 18 | return line; |
| 19 | } catch { |
| 20 | return line; // Return as-is if it's not valid JSON |
| 21 | } |
| 22 | } |
| 23 | return line; |
| 24 | }); |
| 25 | } |
| 26 | |
| 27 | test.describe |
| 28 | .serial('/api/chat', () => { |
no outgoing calls
no test coverage detected
searching dependent graphs…