MCPcopy
hub / github.com/node-cron/node-cron / makeChannel

Function makeChannel

src/coordinator/ipc-run-coordinator.test.ts:7–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5// A fake IPC channel: captures sent messages and lets the test push replies
6// back through the registered 'message' listener.
7function makeChannel() {
8 const emitter = new EventEmitter();
9 const sent: any[] = [];
10 const channel = {
11 sent,
12 send: (message: any) => { sent.push(message); },
13 on: (event: string, listener: (m: any) => void) => emitter.on(event, listener),
14 reply: (message: any) => emitter.emit('message', message),
15 };
16 return channel;
17}
18
19describe('IpcRunCoordinator', function () {
20 it('sends a coordinator:shouldRun request and resolves with the reply', async function () {

Callers 1

Calls 1

onMethod · 0.65

Tested by

no test coverage detected