test(gateway): assert none mode is authoritative with token

This commit is contained in:
Gustavo Madeira Santana 2026-02-19 02:28:20 -05:00
parent 0275281e8d
commit be1b73182c
1 changed files with 19 additions and 0 deletions

View File

@ -130,6 +130,25 @@ describe("gateway auth", () => {
expect(res.method).toBe("none");
});
it("keeps none mode authoritative even when token is present", async () => {
const auth = resolveGatewayAuth({
authConfig: { mode: "none", token: "configured-token" },
env: {} as NodeJS.ProcessEnv,
});
expect(auth).toMatchObject({
mode: "none",
modeSource: "config",
token: "configured-token",
});
const res = await authorizeGatewayConnect({
auth,
connectAuth: null,
});
expect(res.ok).toBe(true);
expect(res.method).toBe("none");
});
it("reports missing and mismatched password reasons", async () => {
const missing = await authorizeGatewayConnect({
auth: { mode: "password", password: "secret", allowTailscale: false },