mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:58:26 +00:00
test: normalize paths in OPENCLAW_HOME tests for cross-platform support (#12212)
* test: normalize paths in OPENCLAW_HOME tests for cross-platform support * test: normalize paths in Nix integration tests for cross-platform support * test: remove unnecessary Windows skip from pi-embedded-runner test * test: fix nix integration tests for path.resolve behavior
This commit is contained in:
@@ -208,22 +208,21 @@ describe("resolveAgentConfig", () => {
|
||||
expect(result?.workspace).toBe("~/openclaw");
|
||||
});
|
||||
|
||||
// Unix-style paths behave differently on Windows; skip there
|
||||
it.skipIf(process.platform === "win32")("uses OPENCLAW_HOME for default agent workspace", () => {
|
||||
vi.stubEnv("OPENCLAW_HOME", "/srv/openclaw-home");
|
||||
it("uses OPENCLAW_HOME for default agent workspace", () => {
|
||||
const home = path.join(path.sep, "srv", "openclaw-home");
|
||||
vi.stubEnv("OPENCLAW_HOME", home);
|
||||
|
||||
const workspace = resolveAgentWorkspaceDir({} as OpenClawConfig, "main");
|
||||
expect(workspace).toBe(path.join(path.resolve("/srv/openclaw-home"), ".openclaw", "workspace"));
|
||||
expect(workspace).toBe(path.join(path.resolve(home), ".openclaw", "workspace"));
|
||||
});
|
||||
|
||||
// Unix-style paths behave differently on Windows; skip there
|
||||
it.skipIf(process.platform === "win32")("uses OPENCLAW_HOME for default agentDir", () => {
|
||||
vi.stubEnv("OPENCLAW_HOME", "/srv/openclaw-home");
|
||||
it("uses OPENCLAW_HOME for default agentDir", () => {
|
||||
const home = path.join(path.sep, "srv", "openclaw-home");
|
||||
vi.stubEnv("OPENCLAW_HOME", home);
|
||||
// Clear state dir so it falls back to OPENCLAW_HOME
|
||||
vi.stubEnv("OPENCLAW_STATE_DIR", "");
|
||||
|
||||
const agentDir = resolveAgentDir({} as OpenClawConfig, "main");
|
||||
expect(agentDir).toBe(
|
||||
path.join(path.resolve("/srv/openclaw-home"), ".openclaw", "agents", "main", "agent"),
|
||||
);
|
||||
expect(agentDir).toBe(path.join(path.resolve(home), ".openclaw", "agents", "main", "agent"));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user