test: remove dead session store fixtures

This commit is contained in:
Peter Steinberger
2026-05-08 09:50:53 +01:00
parent 401ea82d99
commit f8e47ee32a
2 changed files with 30 additions and 28 deletions

View File

@@ -3,6 +3,8 @@ import os from "node:os";
import path from "node:path";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../config/config.js";
import { upsertSessionEntry } from "../../config/sessions/store.js";
import { closeOpenClawAgentDatabasesForTest } from "../../state/openclaw-agent-db.js";
import {
buildFastReplyCommandContext,
initFastReplySessionState,
@@ -59,6 +61,7 @@ describe("getReplyFromConfig fast test bootstrap", () => {
});
afterEach(() => {
closeOpenClawAgentDatabasesForTest();
vi.unstubAllEnvs();
});
@@ -79,7 +82,7 @@ describe("getReplyFromConfig fast test bootstrap", () => {
},
},
channels: { telegram: { allowFrom: ["*"] } },
session: { store: path.join(home, "sessions.json") },
session: {},
} as OpenClawConfig);
await expect(getReplyFromConfig(buildGetReplyCtx(), undefined, cfg)).resolves.toEqual({
@@ -120,7 +123,9 @@ describe("getReplyFromConfig fast test bootstrap", () => {
});
it("marks configs through withFastReplyConfig()", async () => {
const cfg = withFastReplyConfig({ session: { store: "/tmp/sessions.json" } } as OpenClawConfig);
const cfg = withFastReplyConfig({
session: {},
} as OpenClawConfig);
await expect(getReplyFromConfig(buildGetReplyCtx(), undefined, cfg)).resolves.toEqual({
text: "ok",
@@ -217,7 +222,9 @@ describe("getReplyFromConfig fast test bootstrap", () => {
CommandSource: "native",
CommandTargetSessionKey: "agent:main:main",
}),
cfg: { session: { store: "/tmp/sessions.json" } } as OpenClawConfig,
cfg: {
session: {},
} as OpenClawConfig,
agentId: "main",
commandAuthorized: true,
workspaceDir: "/tmp/workspace",
@@ -253,18 +260,16 @@ describe("getReplyFromConfig fast test bootstrap", () => {
it("keeps the existing session for /reset newline soft during fast bootstrap", async () => {
const home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-fast-reset-newline-soft-"));
const storePath = path.join(home, "sessions.json");
vi.stubEnv("OPENCLAW_STATE_DIR", path.join(home, ".openclaw"));
const sessionKey = "agent:main:telegram:123";
await fs.writeFile(
storePath,
JSON.stringify({
[sessionKey]: {
sessionId: "existing-fast-reset-newline-soft",
updatedAt: Date.now(),
},
}),
"utf8",
);
upsertSessionEntry({
agentId: "main",
sessionKey,
entry: {
sessionId: "existing-fast-reset-newline-soft",
updatedAt: Date.now(),
},
});
const result = initFastReplySessionState({
ctx: buildGetReplyCtx({
@@ -273,7 +278,7 @@ describe("getReplyFromConfig fast test bootstrap", () => {
CommandBody: "/reset \nsoft",
SessionKey: sessionKey,
}),
cfg: { session: { store: storePath } } as OpenClawConfig,
cfg: { session: {} } as OpenClawConfig,
agentId: "main",
commandAuthorized: true,
workspaceDir: home,
@@ -286,18 +291,16 @@ describe("getReplyFromConfig fast test bootstrap", () => {
it("keeps the existing session for /reset: soft during fast bootstrap", async () => {
const home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-fast-reset-colon-soft-"));
const storePath = path.join(home, "sessions.json");
vi.stubEnv("OPENCLAW_STATE_DIR", path.join(home, ".openclaw"));
const sessionKey = "agent:main:telegram:123";
await fs.writeFile(
storePath,
JSON.stringify({
[sessionKey]: {
sessionId: "existing-fast-reset-colon-soft",
updatedAt: Date.now(),
},
}),
"utf8",
);
upsertSessionEntry({
agentId: "main",
sessionKey,
entry: {
sessionId: "existing-fast-reset-colon-soft",
updatedAt: Date.now(),
},
});
const result = initFastReplySessionState({
ctx: buildGetReplyCtx({
@@ -306,7 +309,7 @@ describe("getReplyFromConfig fast test bootstrap", () => {
CommandBody: "/reset: soft",
SessionKey: sessionKey,
}),
cfg: { session: { store: storePath } } as OpenClawConfig,
cfg: { session: {} } as OpenClawConfig,
agentId: "main",
commandAuthorized: true,
workspaceDir: home,

View File

@@ -131,7 +131,6 @@ describe("tools.effective handler", () => {
canonicalKey: "missing-session",
entry: undefined,
legacyKey: undefined,
storePath: "/tmp/sessions.json",
} as never);
const { respond, invoke } = createInvokeParams({ sessionKey: "missing-session" });
await invoke();