mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-15 12:00:43 +00:00
test: remove low-value resolveStorePath tilde-expansion unit case
This commit is contained in:
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
||||
import fsPromises from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import type { SessionConfig } from "../types.base.js";
|
||||
import type { SessionEntry } from "./types.js";
|
||||
import {
|
||||
@@ -15,7 +15,6 @@ import { deriveSessionMetaPatch } from "./metadata.js";
|
||||
import {
|
||||
resolveSessionFilePath,
|
||||
resolveSessionTranscriptPathInDir,
|
||||
resolveStorePath,
|
||||
validateSessionId,
|
||||
} from "./paths.js";
|
||||
import { resolveSessionResetPolicy } from "./reset.js";
|
||||
@@ -44,25 +43,6 @@ describe("deriveSessionMetaPatch", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveStorePath", () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it("uses OPENCLAW_HOME for tilde expansion", () => {
|
||||
vi.stubEnv("OPENCLAW_HOME", "/srv/openclaw-home");
|
||||
vi.stubEnv("HOME", "/home/other");
|
||||
|
||||
const resolved = resolveStorePath("~/.openclaw/agents/{agentId}/sessions/sessions.json", {
|
||||
agentId: "research",
|
||||
});
|
||||
|
||||
expect(resolved).toBe(
|
||||
path.resolve("/srv/openclaw-home/.openclaw/agents/research/sessions/sessions.json"),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("session path safety", () => {
|
||||
it("rejects unsafe session IDs", () => {
|
||||
expect(() => validateSessionId("../etc/passwd")).toThrow(/Invalid session ID/);
|
||||
|
||||
Reference in New Issue
Block a user