mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 09:58:38 +00:00
test: tighten openclaw exec env coverage
This commit is contained in:
@@ -27,4 +27,20 @@ describe("ensureOpenClawExecMarkerOnProcess", () => {
|
|||||||
expect(ensureOpenClawExecMarkerOnProcess(env)).toBe(env);
|
expect(ensureOpenClawExecMarkerOnProcess(env)).toBe(env);
|
||||||
expect(env[OPENCLAW_CLI_ENV_VAR]).toBe(OPENCLAW_CLI_ENV_VALUE);
|
expect(env[OPENCLAW_CLI_ENV_VAR]).toBe(OPENCLAW_CLI_ENV_VALUE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("defaults to mutating process.env when no env object is provided", () => {
|
||||||
|
const previous = process.env[OPENCLAW_CLI_ENV_VAR];
|
||||||
|
delete process.env[OPENCLAW_CLI_ENV_VAR];
|
||||||
|
|
||||||
|
try {
|
||||||
|
expect(ensureOpenClawExecMarkerOnProcess()).toBe(process.env);
|
||||||
|
expect(process.env[OPENCLAW_CLI_ENV_VAR]).toBe(OPENCLAW_CLI_ENV_VALUE);
|
||||||
|
} finally {
|
||||||
|
if (previous === undefined) {
|
||||||
|
delete process.env[OPENCLAW_CLI_ENV_VAR];
|
||||||
|
} else {
|
||||||
|
process.env[OPENCLAW_CLI_ENV_VAR] = previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user