MCPcopy
hub / github.com/7836246/cursor2api / test

Function test

test/e2e-chat.mjs:104–121  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

102const results = [];
103
104async function test(name, fn) {
105 process.stdout.write(` ${C.blue}▷${C.reset} ${name} ... `);
106 const t0 = Date.now();
107 try {
108 const info = await fn();
109 const ms = Date.now() - t0;
110 console.log(ok(`通过`) + dim(` (${(ms/1000).toFixed(1)}s)`));
111 if (info) console.log(dim(` → ${info}`));
112 passed++;
113 results.push({ name, ok: true });
114 } catch (e) {
115 const ms = Date.now() - t0;
116 console.log(err(`失败`) + dim(` (${(ms/1000).toFixed(1)}s)`));
117 console.log(` ${C.red}${e.message}${C.reset}`);
118 failed++;
119 results.push({ name, ok: false, error: e.message });
120 }
121}
122
123// ════════════════════════════════════════════════════════════════════
124// 检测服务器是否在线

Callers 1

e2e-chat.mjsFile · 0.70

Calls 6

errFunction · 0.85
logMethod · 0.80
pushMethod · 0.80
okFunction · 0.70
dimFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected