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

Function fixture

__tests__/sync-path-reference-retry.test.ts:93–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91
92describe('schema v13', () => {
93 function fixture(): QueryBuilder {
94 root = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-sync-path-ref-'));
95 db = DatabaseConnection.initialize(path.join(root, 'test.db'));
96 const queries = new QueryBuilder(db.getDb());
97 queries.insertNode({ id: 'a', kind: 'file', name: 'theme.liquid', qualifiedName: 'layout/theme.liquid', filePath: 'layout/theme.liquid',
98 language: 'liquid', startLine: 1, endLine: 1, startColumn: 0, endColumn: 0, updatedAt: 0 });
99 for (const [referenceName, referenceKind, status, tail] of [
100 ['snippets/price.liquid', 'references', 'failed', 'liquid'],
101 ['sections/icon.logo.liquid', 'references', 'failed', 'liquid'],
102 ['snippets/card.liquid', 'references', 'pending', ''],
103 ['package:app/b.dart', 'imports', 'failed', 'b'],
104 ['assert.logfile("logs/error.log").has.line', 'calls', 'failed', 'line'],
105 ['lists::map/2', 'calls', 'failed', 'map'],
106 ] as const) {
107 queries.insertUnresolvedRef({ fromNodeId: 'a', referenceName, referenceKind, line: 1, column: 0, filePath: 'layout/theme.liquid', language: 'liquid' });
108 db.getDb().prepare('UPDATE unresolved_refs SET status = ?, name_tail = ? WHERE reference_name = ?').run(status, tail, referenceName);
109 }
110 return queries;
111 }
112
113 const tails = () => db!.getDb().prepare('SELECT reference_name AS name, name_tail AS tail FROM unresolved_refs ORDER BY id').all();
114

Calls 7

insertNodeMethod · 0.95
insertUnresolvedRefMethod · 0.95
getDbMethod · 0.80
runMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected