mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 23:21:23 +00:00
test: tighten relay smoke + slack token validation
This commit is contained in:
@@ -10,6 +10,18 @@ describe("parseRelaySmokeTest", () => {
|
||||
expect(parseRelaySmokeTest(["--smoke", "qr"], {})).toBe("qr");
|
||||
});
|
||||
|
||||
it("rejects --smoke without a value", () => {
|
||||
expect(() => parseRelaySmokeTest(["--smoke"], {})).toThrow(
|
||||
"Missing value for --smoke (expected: qr)",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects --smoke when the next arg is another flag", () => {
|
||||
expect(() => parseRelaySmokeTest(["--smoke", "--smoke-qr"], {})).toThrow(
|
||||
"Missing value for --smoke (expected: qr)",
|
||||
);
|
||||
});
|
||||
|
||||
it("parses --smoke-qr", () => {
|
||||
expect(parseRelaySmokeTest(["--smoke-qr"], {})).toBe("qr");
|
||||
});
|
||||
@@ -19,9 +31,18 @@ describe("parseRelaySmokeTest", () => {
|
||||
expect(parseRelaySmokeTest(["send"], { OPENCLAW_SMOKE_QR: "1" })).toBe(null);
|
||||
});
|
||||
|
||||
it("supports OPENCLAW_SMOKE=qr only when no args", () => {
|
||||
expect(parseRelaySmokeTest([], { OPENCLAW_SMOKE: "qr" })).toBe("qr");
|
||||
expect(parseRelaySmokeTest(["send"], { OPENCLAW_SMOKE: "qr" })).toBe(null);
|
||||
});
|
||||
|
||||
it("rejects unknown smoke values", () => {
|
||||
expect(() => parseRelaySmokeTest(["--smoke", "nope"], {})).toThrow("Unknown smoke test");
|
||||
});
|
||||
|
||||
it("prefers explicit --smoke over env vars", () => {
|
||||
expect(parseRelaySmokeTest(["--smoke", "qr"], { OPENCLAW_SMOKE: "nope" })).toBe("qr");
|
||||
});
|
||||
});
|
||||
|
||||
describe("runRelaySmokeTest", () => {
|
||||
|
||||
Reference in New Issue
Block a user