(name: string, responses: { results?: any[]; error?: Error })
| 110 | |
| 111 | describe('WebSearchTool with injected backend', () => { |
| 112 | function makeStubBackend(name: string, responses: { results?: any[]; error?: Error }): WebSearchBackend { |
| 113 | return { |
| 114 | name, |
| 115 | requiresAuth: false, |
| 116 | async search(_q, _o) { |
| 117 | if (responses.error) throw responses.error; |
| 118 | return responses.results ?? []; |
| 119 | }, |
| 120 | }; |
| 121 | } |
| 122 | |
| 123 | it('formats successful results with a numbered listing', async () => { |
| 124 | const tool = new WebSearchTool(); |