mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05: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";
|
||||
|
||||
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", () => {
|
||||
it("should not auto-generate token when auth mode is trusted-proxy", async () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
@@ -16,15 +26,7 @@ describe("ensureBrowserControlAuth", () => {
|
||||
trustedProxies: ["192.168.1.1"],
|
||||
},
|
||||
};
|
||||
|
||||
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();
|
||||
await expectNoAutoGeneratedAuth(cfg);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,15 +39,7 @@ describe("ensureBrowserControlAuth", () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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();
|
||||
await expectNoAutoGeneratedAuth(cfg);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -58,15 +52,7 @@ describe("ensureBrowserControlAuth", () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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();
|
||||
await expectNoAutoGeneratedAuth(cfg);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user