refactor(cli): dedupe gateway run mode parsing

This commit is contained in:
Peter Steinberger
2026-02-26 19:50:27 +01:00
parent f7041fbee3
commit d92fc85555
2 changed files with 60 additions and 31 deletions

View File

@@ -118,6 +118,17 @@ describe("gateway run option collisions", () => {
});
}
function expectAuthOverrideMode(mode: string) {
expect(startGatewayServer).toHaveBeenCalledWith(
18789,
expect.objectContaining({
auth: expect.objectContaining({
mode,
}),
}),
);
}
it("forwards parent-captured options to `gateway run` subcommand", async () => {
await runGatewayCli([
"gateway",
@@ -156,27 +167,13 @@ describe("gateway run option collisions", () => {
it("accepts --auth none override", async () => {
await runGatewayCli(["gateway", "run", "--auth", "none", "--allow-unconfigured"]);
expect(startGatewayServer).toHaveBeenCalledWith(
18789,
expect.objectContaining({
auth: expect.objectContaining({
mode: "none",
}),
}),
);
expectAuthOverrideMode("none");
});
it("accepts --auth trusted-proxy override", async () => {
await runGatewayCli(["gateway", "run", "--auth", "trusted-proxy", "--allow-unconfigured"]);
expect(startGatewayServer).toHaveBeenCalledWith(
18789,
expect.objectContaining({
auth: expect.objectContaining({
mode: "trusted-proxy",
}),
}),
);
expectAuthOverrideMode("trusted-proxy");
});
it("prints all supported modes on invalid --auth value", async () => {