// Session path helper tests pin default store path contracts used by CLI commands.
import path from "node:path";
import { describe, expect, it } from "vitest";
import { resolveStorePath } from "./paths.js";

describe("resolveStorePath", () => {
  it("uses the default agent store when session.store is absent or blank", () => {
    const stateDir = path.join(path.parse(process.cwd()).root, "openclaw-test-state");
    const env = {
      ...process.env,
      OPENCLAW_STATE_DIR: stateDir,
    };
    const expected = path.join(stateDir, "agents", "work", "sessions", "sessions.json");

    expect(resolveStorePath(undefined, { agentId: "work", env })).toBe(expected);
    expect(resolveStorePath("", { agentId: "work", env })).toBe(expected);
  });
});
