Files
openclaw/test/scripts/proxy-install-ca.test.ts
T
Peter Steinberger c70aee247e refactor(scripts): migrate JavaScript tools to TypeScript (#121005)
* refactor(scripts): migrate JavaScript tools to TypeScript

* fix(ci): keep changed-scope preflight zero-install

* fix(ci): preserve zero-install script owners

* fix(ci): complete script migration follow-through

* fix(release): keep stable closeout zero-install

* fix(scripts): preserve standalone execution boundaries

* fix(scripts): repair standalone loader boundaries

* fix(scripts): normalize gateway observation ids

* fix(scripts): keep Docker packager standalone

* test(scripts): preserve rebase cleanup helpers

* test(sessions): use tracked temp directory
2026-08-09 07:21:35 -07:00

54 lines
1.8 KiB
TypeScript

import { spawnSync } from "node:child_process";
// Proxy CA installer tests keep macOS trust changes behind explicit CLI args.
import { existsSync } from "node:fs";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { cleanupTempDirs, makeTempDir } from "../helpers/temp-dir.js";
const SCRIPT = "scripts/proxy-install-ca.mts";
const tempDirs = new Set<string>();
afterEach(() => {
cleanupTempDirs(tempDirs);
});
function runProxyInstallCa(args: string[], certDir: string) {
return spawnSync(process.execPath, ["--import", "tsx", SCRIPT, ...args], {
cwd: process.cwd(),
encoding: "utf8",
env: {
...process.env,
OPENCLAW_DEBUG_PROXY_CERT_DIR: certDir,
},
});
}
describe("scripts/proxy-install-ca.mts", () => {
it("rejects unknown arguments before creating the debug proxy CA", () => {
const root = makeTempDir(tempDirs, "openclaw-proxy-install-ca-");
const certDir = join(root, "certs");
const result = runProxyInstallCa(["--print-onli"], certDir);
expect(result.status).toBe(1);
expect(result.stderr).toContain("Unknown proxy install CA argument: --print-onli");
expect(result.stderr).toContain(
"Usage: node --import tsx scripts/proxy-install-ca.mts [--print-only]",
);
expect(result.stdout).toBe("");
expect(existsSync(certDir)).toBe(false);
});
it("prints usage without creating the debug proxy CA", () => {
const root = makeTempDir(tempDirs, "openclaw-proxy-install-ca-");
const certDir = join(root, "certs");
const result = runProxyInstallCa(["--help"], certDir);
expect(result.status).toBe(0);
expect(result.stdout).toContain(
"Usage: node --import tsx scripts/proxy-install-ca.mts [--print-only]",
);
expect(result.stderr).toBe("");
expect(existsSync(certDir)).toBe(false);
});
});