fix(cli): fix flaky config set help text test caused by env var leakage and word wrapping (#83423)

Merged via squash.

Prepared head SHA: 7ba1bac70c
Co-authored-by: medns <1575008+medns@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
Super Zheng
2026-05-19 05:11:52 +08:00
committed by GitHub
parent 721ad1587a
commit d124c5aa20
+6 -7
View File
@@ -1224,14 +1224,13 @@ describe("config cli", () => {
expect(helpText).toContain("--batch-json");
expect(helpText).toContain("--dry-run");
expect(helpText).toContain("--allow-exec");
expect(helpText).toContain("openclaw config set gateway.port 19001 --strict-json");
expect(helpText).toContain(
"openclaw config set channels.discord.token --ref-provider default --ref-source",
);
expect(helpText).toContain("--ref-id DISCORD_BOT_TOKEN");
expect(helpText).toContain(
"openclaw config set --batch-file ./config-set.batch.json --dry-run",
// Ignore Commander line wrapping and env-injected CLI prefixes.
const normalizedHelp = helpText.replace(/\s+/g, " ");
expect(normalizedHelp).toContain("config set gateway.port 19001 --strict-json");
expect(normalizedHelp).toContain(
"channels.discord.token --ref-provider default --ref-source env --ref-id DISCORD_BOT_TOKEN",
);
expect(normalizedHelp).toContain("--batch-file ./config-set.batch.json --dry-run");
});
});