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

Function fixture

__tests__/sync-synthesis-interval.test.ts:40–45  ·  view source on GitHub ↗

A bus, a handler registered on it, and a service that emits: one event-emitter edge.

(dir: string)

Source from the content-addressed store, hash-verified

38
39/** A bus, a handler registered on it, and a service that emits: one event-emitter edge. */
40function fixture(dir: string): void {
41 write(dir, 'package.json', JSON.stringify({ name: 'app' }));
42 write(dir, 'src/bus.js', "const { EventEmitter } = require('events');\nconst bus = new EventEmitter();\nmodule.exports = { bus };\n");
43 write(dir, 'src/handlers.js', "const { bus } = require('./bus');\nfunction onSaved(doc) { return doc; }\nbus.on('saved', onSaved);\nmodule.exports = { onSaved };\n");
44 write(dir, 'src/service.js', "const { bus } = require('./bus');\nfunction save(doc) { bus.emit('saved', doc); return doc; }\nmodule.exports = { save };\n");
45}
46
47/** A second event on the bus: the edit that makes a sync rebuild the synthesized edges. */
48function addRemovedEvent(dir: string): void {

Callers 1

indexedFunction · 0.70

Calls 1

writeFunction · 0.70

Tested by

no test coverage detected