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

Function syncEdit

__tests__/sync-default-export-change.test.ts:104–114  ·  view source on GitHub ↗

Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds.

(before: Files, after: Files)

Source from the content-addressed store, hash-verified

102
103/** Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds. */
104async function syncEdit(before: Files, after: Files): Promise<{ root: string; graph: CodeGraph; full: string[]; modified: number }> {
105 const root = tempRoot();
106 write(root, before);
107 const graph = await index(root);
108 write(root, after);
109 const result = await graph.sync();
110 const fullRoot = tempRoot();
111 write(fullRoot, { ...before, ...after });
112 const full = stateOf(fullRoot, await index(fullRoot));
113 return { root, graph, full, modified: result.filesModified };
114}
115
116describe('sync re-links default-import readers when the module default changes', () => {
117 it('when `export default` names another declaration', async () => {

Calls 5

tempRootFunction · 0.70
writeFunction · 0.70
indexFunction · 0.70
stateOfFunction · 0.70
syncMethod · 0.45

Tested by

no test coverage detected