diff --git a/src/channels/plugins/contracts/inbound.contract.test.ts b/src/channels/plugins/contracts/inbound.contract.test.ts index 90c4ff61722..6fe8ec020ce 100644 --- a/src/channels/plugins/contracts/inbound.contract.test.ts +++ b/src/channels/plugins/contracts/inbound.contract.test.ts @@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { buildDiscordInboundAccessContext } from "../../../../extensions/discord/src/monitor/inbound-context.js"; import type { ResolvedSlackAccount } from "../../../../extensions/slack/src/accounts.js"; import type { SlackMessageEvent } from "../../../../extensions/slack/src/types.js"; +import { withTempHome } from "../../../../test/helpers/temp-home.js"; import type { MsgContext } from "../../../auto-reply/templating.js"; import type { OpenClawConfig } from "../../../config/config.js"; import { inboundCtxCapture } from "./inbound-testkit.js"; @@ -178,23 +179,25 @@ describe("channel inbound contract", () => { }); it("keeps Slack inbound context finalized", async () => { - const ctx = createInboundSlackTestContext({ - cfg: { - channels: { slack: { enabled: true } }, - } as OpenClawConfig, - }); - // oxlint-disable-next-line typescript/no-explicit-any - ctx.resolveUserName = async () => ({ name: "Alice" }) as any; + await withTempHome(async () => { + const ctx = createInboundSlackTestContext({ + cfg: { + channels: { slack: { enabled: true } }, + } as OpenClawConfig, + }); + // oxlint-disable-next-line typescript/no-explicit-any + ctx.resolveUserName = async () => ({ name: "Alice" }) as any; - const prepared = await prepareSlackMessage({ - ctx, - account: createSlackAccount(), - message: createSlackMessage({}), - opts: { source: "message" }, - }); + const prepared = await prepareSlackMessage({ + ctx, + account: createSlackAccount(), + message: createSlackMessage({}), + opts: { source: "message" }, + }); - expect(prepared).toBeTruthy(); - expectChannelInboundContextContract(prepared!.ctxPayload); + expect(prepared).toBeTruthy(); + expectChannelInboundContextContract(prepared!.ctxPayload); + }); }); it("keeps Telegram inbound context finalized", async () => { diff --git a/src/cli/command-secret-resolution.coverage.test.ts b/src/cli/command-secret-resolution.coverage.test.ts index 192a48ab3b6..bc2e1109f75 100644 --- a/src/cli/command-secret-resolution.coverage.test.ts +++ b/src/cli/command-secret-resolution.coverage.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { readCommandSource } from "./command-source.test-helpers.js"; const SECRET_TARGET_CALLSITES = [ - "src/cli/memory-cli.ts", + "src/cli/memory-cli.runtime.ts", "src/cli/qr-cli.ts", "src/commands/agent.ts", "src/commands/channels/resolve.ts", diff --git a/src/config/sessions/targets.test.ts b/src/config/sessions/targets.test.ts index 67366634b0a..3a3c63b180e 100644 --- a/src/config/sessions/targets.test.ts +++ b/src/config/sessions/targets.test.ts @@ -3,7 +3,6 @@ import fs from "node:fs/promises"; import path from "node:path"; import { describe, expect, it } from "vitest"; import { withTempHome } from "../../../test/helpers/temp-home.js"; -import { withPathResolutionEnv } from "../../test-utils/env.js"; import type { OpenClawConfig } from "../config.js"; import { resolveStorePath } from "./paths.js"; import { @@ -78,37 +77,30 @@ const discoveryResolvers = [ ] as const; describe("resolveSessionStoreTargets", () => { - it("resolves all configured agent stores", () => { - const cfg: OpenClawConfig = { - session: { - store: "~/.openclaw/agents/{agentId}/sessions/sessions.json", - }, - agents: { - list: [{ id: "main", default: true }, { id: "work" }], - }, - }; + it("resolves all configured agent stores", async () => { + await withTempHome(async (home) => { + const cfg: OpenClawConfig = { + session: { + store: "~/.openclaw/agents/{agentId}/sessions/sessions.json", + }, + agents: { + list: [{ id: "main", default: true }, { id: "work" }], + }, + }; - const homeDir = path.resolve(path.sep, "tmp", "openclaw-home"); - const targets = withPathResolutionEnv(homeDir, {}, (env) => - resolveSessionStoreTargets(cfg, { allAgents: true }, { env }), - ); - - expect(targets).toEqual([ - { - agentId: "main", - storePath: resolveStorePath(cfg.session?.store, { + const env = { ...process.env }; + const targets = resolveSessionStoreTargets(cfg, { allAgents: true }, { env }); + expect(targets).toEqual([ + { agentId: "main", - env: { HOME: homeDir }, - }), - }, - { - agentId: "work", - storePath: resolveStorePath(cfg.session?.store, { + storePath: resolveStorePath(cfg.session?.store, { agentId: "main", env }), + }, + { agentId: "work", - env: { HOME: homeDir }, - }), - }, - ]); + storePath: resolveStorePath(cfg.session?.store, { agentId: "work", env }), + }, + ]); + }); }); it("dedupes shared store paths for --all-agents", () => {