Tests: restore TUI gateway env
parent
a13ff55bd9
commit
5e025c4ba3
|
|
@ -1,8 +1,11 @@
|
|||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const loadConfig = vi.fn();
|
||||
const resolveGatewayPort = vi.fn();
|
||||
|
||||
const originalEnvToken = process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
const originalEnvPassword = process.env.OPENCLAW_GATEWAY_PASSWORD;
|
||||
|
||||
vi.mock("../config/config.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../config/config.js")>();
|
||||
return {
|
||||
|
|
@ -19,6 +22,22 @@ describe("resolveGatewayConnection", () => {
|
|||
loadConfig.mockReset();
|
||||
resolveGatewayPort.mockReset();
|
||||
resolveGatewayPort.mockReturnValue(18789);
|
||||
delete process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
delete process.env.OPENCLAW_GATEWAY_PASSWORD;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (originalEnvToken === undefined) {
|
||||
delete process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
} else {
|
||||
process.env.OPENCLAW_GATEWAY_TOKEN = originalEnvToken;
|
||||
}
|
||||
|
||||
if (originalEnvPassword === undefined) {
|
||||
delete process.env.OPENCLAW_GATEWAY_PASSWORD;
|
||||
} else {
|
||||
process.env.OPENCLAW_GATEWAY_PASSWORD = originalEnvPassword;
|
||||
}
|
||||
});
|
||||
|
||||
it("throws when url override is missing explicit credentials", () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue