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

Function syncs

__tests__/cpp-template-instantiations.test.ts:1253–1263  ·  view source on GitHub ↗
(before: Record<string, string>, after: Record<string, string>, removed: string[] = [])

Source from the content-addressed store, hash-verified

1251
1252 /** Index `before`, write `after`, sync, and compare with a fresh index of `after`. */
1253 const syncs = async (before: Record<string, string>, after: Record<string, string>, removed: string[] = []): Promise<string[]> => {
1254 const root = project(before);
1255 const cg = await opened(root);
1256 write(root, after);
1257 for (const file of removed) fs.rmSync(path.join(root, file));
1258 await cg.sync();
1259 const fresh = await indexed(Object.fromEntries(
1260 Object.entries({ ...before, ...after }).filter(([file]) => !removed.includes(file))));
1261 expect(asText(cg)).toEqual(asText(fresh));
1262 return reached(cg, 'Mixin::Add');
1263 };
1264
1265 it('an instantiation added in a third file', async () => {
1266 expect(await syncs(BASE, { 'added.cc': lines('#include "mixin.h"', 'Mixin<FancyTxn> added;') }))

Calls 8

openedFunction · 0.85
projectFunction · 0.70
writeFunction · 0.70
indexedFunction · 0.70
asTextFunction · 0.70
reachedFunction · 0.70
joinMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected