MCPcopy Create free account
hub / github.com/dwgx/WindsurfAPI / fakeRes

Function fakeRes

test/stream-error.test.js:34–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34function fakeRes() {
35 const listeners = new Map();
36 return {
37 body: '',
38 writableEnded: false,
39 write(chunk) { this.body += String(chunk); return true; },
40 end(chunk) {
41 if (chunk) this.write(chunk);
42 this.writableEnded = true;
43 for (const cb of listeners.get('close') || []) cb();
44 },
45 on(event, cb) {
46 if (!listeners.has(event)) listeners.set(event, []);
47 listeners.get(event).push(cb);
48 return this;
49 },
50 };
51}
52
53describe('stream error protocol', () => {
54 it('creates OpenAI-style structured stream errors', () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected