mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:38:25 +00:00
test(browser): dedupe auth mode no-token assertions
This commit is contained in:
@@ -3,6 +3,16 @@ import type { OpenClawConfig } from "../config/types.js";
|
|||||||
import { ensureBrowserControlAuth } from "./control-auth.js";
|
import { ensureBrowserControlAuth } from "./control-auth.js";
|
||||||
|
|
||||||
describe("ensureBrowserControlAuth", () => {
|
describe("ensureBrowserControlAuth", () => {
|
||||||
|
async function expectNoAutoGeneratedAuth(cfg: OpenClawConfig): Promise<void> {
|
||||||
|
const result = await ensureBrowserControlAuth({
|
||||||
|
cfg,
|
||||||
|
env: { OPENCLAW_BROWSER_AUTO_AUTH: "1" },
|
||||||
|
});
|
||||||
|
expect(result.generatedToken).toBeUndefined();
|
||||||
|
expect(result.auth.token).toBeUndefined();
|
||||||
|
expect(result.auth.password).toBeUndefined();
|
||||||
|
}
|
||||||
|
|
||||||
describe("trusted-proxy mode", () => {
|
describe("trusted-proxy mode", () => {
|
||||||
it("should not auto-generate token when auth mode is trusted-proxy", async () => {
|
it("should not auto-generate token when auth mode is trusted-proxy", async () => {
|
||||||
const cfg: OpenClawConfig = {
|
const cfg: OpenClawConfig = {
|
||||||
@@ -16,15 +26,7 @@ describe("ensureBrowserControlAuth", () => {
|
|||||||
trustedProxies: ["192.168.1.1"],
|
trustedProxies: ["192.168.1.1"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
await expectNoAutoGeneratedAuth(cfg);
|
||||||
const result = await ensureBrowserControlAuth({
|
|
||||||
cfg,
|
|
||||||
env: { OPENCLAW_BROWSER_AUTO_AUTH: "1" },
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result.generatedToken).toBeUndefined();
|
|
||||||
expect(result.auth.token).toBeUndefined();
|
|
||||||
expect(result.auth.password).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -37,15 +39,7 @@ describe("ensureBrowserControlAuth", () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
await expectNoAutoGeneratedAuth(cfg);
|
||||||
const result = await ensureBrowserControlAuth({
|
|
||||||
cfg,
|
|
||||||
env: { OPENCLAW_BROWSER_AUTO_AUTH: "1" },
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result.generatedToken).toBeUndefined();
|
|
||||||
expect(result.auth.token).toBeUndefined();
|
|
||||||
expect(result.auth.password).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -58,15 +52,7 @@ describe("ensureBrowserControlAuth", () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
await expectNoAutoGeneratedAuth(cfg);
|
||||||
const result = await ensureBrowserControlAuth({
|
|
||||||
cfg,
|
|
||||||
env: { OPENCLAW_BROWSER_AUTO_AUTH: "1" },
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result.generatedToken).toBeUndefined();
|
|
||||||
expect(result.auth.token).toBeUndefined();
|
|
||||||
expect(result.auth.password).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user