@@ -4,16 +4,17 @@ import path from "node:path";
|
4 | 4 | import { afterEach, describe, expect, it, vi } from "vitest"; |
5 | 5 | import type { OpenClawConfig } from "../../config/types.openclaw.js"; |
6 | 6 | import { withTempDir } from "../../test-helpers/temp-dir.js"; |
| 7 | +import { deleteTestEnvValue, setTestEnvValue } from "../../test-utils/env.js"; |
7 | 8 | import type { MsgContext } from "../templating.js"; |
8 | 9 | import { resolveCurrentTurnImages } from "./current-turn-images.js"; |
9 | 10 | |
10 | 11 | const originalStateDirEnv = process.env.OPENCLAW_STATE_DIR; |
11 | 12 | |
12 | 13 | function restoreProcessState() { |
13 | 14 | if (originalStateDirEnv === undefined) { |
14 | | -delete process.env.OPENCLAW_STATE_DIR; |
| 15 | +deleteTestEnvValue("OPENCLAW_STATE_DIR"); |
15 | 16 | } else { |
16 | | -process.env.OPENCLAW_STATE_DIR = originalStateDirEnv; |
| 17 | +setTestEnvValue("OPENCLAW_STATE_DIR", originalStateDirEnv); |
17 | 18 | } |
18 | 19 | } |
19 | 20 | |
@@ -33,7 +34,7 @@ describe("resolveCurrentTurnImages", () => {
|
33 | 34 | await fs.mkdir(path.dirname(attachmentPath), { recursive: true }); |
34 | 35 | await fs.mkdir(cwd, { recursive: true }); |
35 | 36 | await fs.writeFile(attachmentPath, imageBytes); |
36 | | -process.env.OPENCLAW_STATE_DIR = stateDir; |
| 37 | +setTestEnvValue("OPENCLAW_STATE_DIR", stateDir); |
37 | 38 | vi.spyOn(process, "cwd").mockReturnValue(cwd); |
38 | 39 | |
39 | 40 | const result = await resolveCurrentTurnImages({ |
|