* Array.fromAsync ponyfill, which will be available in es 2024. * * Buffers an async generator into an array and returns the result.
(promise: AsyncGenerator<T>)
| 155 | * Buffers an async generator into an array and returns the result. |
| 156 | */ |
| 157 | async function fromAsync<T>(promise: AsyncGenerator<T>): Promise<readonly T[]> { |
| 158 | const results: T[] = []; |
| 159 | for await (const result of promise) { |
| 160 | results.push(result); |
| 161 | } |
| 162 | return results; |
| 163 | } |
| 164 | |
| 165 | describe('Gemini Client (client.ts)', () => { |
| 166 | let mockContentGenerator: ContentGenerator; |