mirror of https://github.com/openclaw/openclaw.git
test: stabilize qr dashboard ci assertion
This commit is contained in:
parent
dc21e3bb1e
commit
9f132fc1b0
|
|
@ -94,6 +94,20 @@ function decodeSetupCode(setupCode: string): {
|
|||
};
|
||||
}
|
||||
|
||||
function findSetupCodeLogLine(lines: string[]): string | undefined {
|
||||
for (const line of lines) {
|
||||
try {
|
||||
const payload = decodeSetupCode(line);
|
||||
if (payload.url || payload.bootstrapToken) {
|
||||
return line;
|
||||
}
|
||||
} catch {
|
||||
// Ignore non-setup-code log lines.
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async function runCli(args: string[]): Promise<void> {
|
||||
const program = new Command();
|
||||
registerQrCli(program);
|
||||
|
|
@ -138,7 +152,8 @@ describe("cli integration: qr + dashboard token SecretRef", () => {
|
|||
});
|
||||
|
||||
await runCli(["qr", "--setup-code-only"]);
|
||||
const setupCode = runtimeLogs.at(-1);
|
||||
expect(runtime.exit).not.toHaveBeenCalled();
|
||||
const setupCode = findSetupCodeLogLine(runtimeLogs);
|
||||
expect(setupCode).toBeTruthy();
|
||||
const payload = decodeSetupCode(setupCode ?? "");
|
||||
expect(payload.url).toBe("ws://127.0.0.1:18789");
|
||||
|
|
|
|||
Loading…
Reference in New Issue