MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / idOf

Function idOf

__tests__/ui-server-api.test.ts:93–100  ·  view source on GitHub ↗

Find a symbol in the fixture by name, through the API itself.

(name: string, kind?: string)

Source from the content-addressed store, hash-verified

91
92/** Find a symbol in the fixture by name, through the API itself. */
93async 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
102beforeAll(async () => {
103 tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-ui-api-'));

Callers 1

Calls 1

getJsonFunction · 0.70

Tested by

no test coverage detected