mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 20:20:45 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
24 lines
715 B
TypeScript
24 lines
715 B
TypeScript
import { expect } from "vitest";
|
|
|
|
export function extractPairingCode(text: string): string {
|
|
const code = text.match(/Pairing code:\s*```[\r\n]+([A-Z2-9]{6,})/)?.[1];
|
|
expect(code).toBeDefined();
|
|
return code ?? "";
|
|
}
|
|
|
|
export function expectPairingReplyText(
|
|
text: string,
|
|
params: {
|
|
channel: string;
|
|
idLine: string;
|
|
code?: string;
|
|
},
|
|
): string {
|
|
const code = params.code ?? extractPairingCode(text);
|
|
expect(text).toContain("OpenClaw: access not configured.");
|
|
expect(text).toContain(params.idLine);
|
|
expect(text).toContain("Pairing code:");
|
|
expect(text).toContain(`\n\`\`\`\n${code}\n\`\`\`\n`);
|
|
expect(text).toContain(`pairing approve ${params.channel} ${code}`);
|
|
return code;
|
|
}
|