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

Function freshDb

__tests__/sync-synthesis-inputs.test.ts:95–101  ·  view source on GitHub ↗

A fresh database holding one indexed file, `src/App.tsx`.

()

Source from the content-addressed store, hash-verified

93
94 /** A fresh database holding one indexed file, `src/App.tsx`. */
95 function freshDb(): void {
96 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-synth-inputs-db-'));
97 roots.push(dir);
98 connection = DatabaseConnection.initialize(path.join(dir, 'test.db'));
99 queries = new QueryBuilder(connection.getDb());
100 queries.upsertFile({ path: 'src/App.tsx', contentHash: 'h', language: 'tsx', size: 1, modifiedAt: 1, indexedAt: 1, nodeCount: 0, errors: [], generated: false } as never);
101 }
102 const recorded = (): string[] =>
103 (connection.getDb().prepare('SELECT file_path FROM synthesis_inputs ORDER BY file_path').all() as Array<{ file_path: string }>).map((r) => r.file_path);
104

Callers 1

Calls 5

pushMethod · 0.80
getDbMethod · 0.80
upsertFileMethod · 0.80
joinMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected