Find a symbol in the fixture by name, through the API itself.
(name: string, kind?: string)
| 91 | |
| 92 | /** Find a symbol in the fixture by name, through the API itself. */ |
| 93 | async function idOf(name: string, kind?: string): Promise<string> { |
| 94 | const search = await getJson(`/api/search?q=${encodeURIComponent(name)}`); |
| 95 | const hit = search.results.items.find( |
| 96 | (r: any) => r.name === name && (kind === undefined || r.kind === kind) |
| 97 | ); |
| 98 | expect(hit, `no ${kind ?? 'symbol'} named ${name} in the fixture`).toBeTruthy(); |
| 99 | return hit.id as string; |
| 100 | } |
| 101 | |
| 102 | beforeAll(async () => { |
| 103 | tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-ui-api-')); |
no test coverage detected