mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:40:44 +00:00
test: remove duplicated env lookup helper
This commit is contained in:
@@ -3,19 +3,6 @@ import { withEnv } from "../test-utils/env.js";
|
||||
import { decodeCapturedOutputBuffer, parseWindowsCodePage, sanitizeEnv } from "./invoke.js";
|
||||
import { buildNodeInvokeResultParams } from "./runner.js";
|
||||
|
||||
function getEnvValueCaseInsensitive(
|
||||
env: Record<string, string>,
|
||||
expectedKey: string,
|
||||
): string | undefined {
|
||||
const direct = env[expectedKey];
|
||||
if (direct !== undefined) {
|
||||
return direct;
|
||||
}
|
||||
const upper = expectedKey.toUpperCase();
|
||||
const actualKey = Object.keys(env).find((key) => key.toUpperCase() === upper);
|
||||
return actualKey ? env[actualKey] : undefined;
|
||||
}
|
||||
|
||||
describe("node-host sanitizeEnv", () => {
|
||||
it("ignores PATH overrides", () => {
|
||||
withEnv({ PATH: "/usr/bin" }, () => {
|
||||
@@ -68,7 +55,7 @@ describe("node-host sanitizeEnv", () => {
|
||||
it("preserves inherited non-portable Windows-style env keys", () => {
|
||||
withEnv({ "ProgramFiles(x86)": "C:\\Program Files (x86)" }, () => {
|
||||
const env = sanitizeEnv(undefined);
|
||||
expect(getEnvValueCaseInsensitive(env, "ProgramFiles(x86)")).toBe("C:\\Program Files (x86)");
|
||||
expect(env["ProgramFiles(x86)"]).toBe("C:\\Program Files (x86)");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user