()
| 83 | } |
| 84 | |
| 85 | function createModelsFetchRecorder() { |
| 86 | let request: |
| 87 | | { |
| 88 | url: string |
| 89 | method: string | undefined |
| 90 | headers: Headers |
| 91 | } |
| 92 | | undefined |
| 93 | |
| 94 | const fetchOverride: FetchOverride = async (input, init) => { |
| 95 | request = { |
| 96 | url: input instanceof Request ? input.url : String(input), |
| 97 | method: init?.method, |
| 98 | headers: new Headers(init?.headers), |
| 99 | } |
| 100 | return new Response(JSON.stringify({ data: [{ id: 'test-model' }] }), { |
| 101 | status: 200, |
| 102 | headers: { 'content-type': 'application/json' }, |
| 103 | }) |
| 104 | } |
| 105 | |
| 106 | return { |
| 107 | fetchOverride, |
| 108 | getRequest() { |
| 109 | expect(request).toBeDefined() |
| 110 | return request as NonNullable<typeof request> |
| 111 | }, |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | async function collectModels(client: OpenAICompatInferenceClient) { |
| 116 | const models: Array<Record<string, unknown>> = [] |
no outgoing calls
no test coverage detected