mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 14:51:08 +00:00
test: narrow qr dashboard integration surfaces
This commit is contained in:
committed by
Peter Steinberger
parent
652f273a0f
commit
ccdd33545b
@@ -33,8 +33,8 @@ vi.mock("../runtime.js", () => ({
|
||||
defaultRuntime: runtime,
|
||||
}));
|
||||
|
||||
let dashboardCommand: typeof import("../commands/dashboard.js").dashboardCommand;
|
||||
let registerQrCli: typeof import("./qr-cli.js").registerQrCli;
|
||||
let registerMaintenanceCommands: typeof import("./program/register.maintenance.js").registerMaintenanceCommands;
|
||||
|
||||
function createGatewayTokenRefFixture() {
|
||||
return {
|
||||
@@ -81,7 +81,6 @@ function decodeSetupCode(setupCode: string): {
|
||||
async function runCli(args: string[]): Promise<void> {
|
||||
const program = new Command();
|
||||
registerQrCli(program);
|
||||
registerMaintenanceCommands(program);
|
||||
await program.parseAsync(args, { from: "user" });
|
||||
}
|
||||
|
||||
@@ -92,17 +91,16 @@ const unmockedDependencyIds = [
|
||||
"../gateway/resolve-configured-secret-input-string.js",
|
||||
"../pairing/setup-code.js",
|
||||
"./command-secret-gateway.js",
|
||||
"./program/register.maintenance.js",
|
||||
"./qr-cli.js",
|
||||
];
|
||||
] as const;
|
||||
|
||||
async function loadCliModules() {
|
||||
vi.resetModules();
|
||||
for (const id of unmockedDependencyIds) {
|
||||
vi.doUnmock(id);
|
||||
}
|
||||
({ dashboardCommand } = await import("../commands/dashboard.js"));
|
||||
({ registerQrCli } = await import("./qr-cli.js"));
|
||||
({ registerMaintenanceCommands } = await import("./program/register.maintenance.js"));
|
||||
}
|
||||
|
||||
describe("cli integration: qr + dashboard token SecretRef", () => {
|
||||
@@ -163,7 +161,7 @@ describe("cli integration: qr + dashboard token SecretRef", () => {
|
||||
|
||||
runtimeLogs.length = 0;
|
||||
runtimeErrors.length = 0;
|
||||
await runCli(["dashboard", "--no-open"]);
|
||||
await dashboardCommand(runtime, { noOpen: true });
|
||||
const joined = runtimeLogs.join("\n");
|
||||
expect(joined).toContain("Dashboard URL: http://127.0.0.1:18789/");
|
||||
expect(joined).not.toContain("#token=");
|
||||
@@ -191,7 +189,7 @@ describe("cli integration: qr + dashboard token SecretRef", () => {
|
||||
|
||||
runtimeLogs.length = 0;
|
||||
runtimeErrors.length = 0;
|
||||
await runCli(["dashboard", "--no-open"]);
|
||||
await dashboardCommand(runtime, { noOpen: true });
|
||||
const joined = runtimeLogs.join("\n");
|
||||
expect(joined).toContain("Dashboard URL: http://127.0.0.1:18789/");
|
||||
expect(joined).not.toContain("#token=");
|
||||
|
||||
Reference in New Issue
Block a user