diff --git a/extensions/memory-core/src/dreaming-narrative.test.ts b/extensions/memory-core/src/dreaming-narrative.test.ts index 4ea7b739659..1ce74ca1651 100644 --- a/extensions/memory-core/src/dreaming-narrative.test.ts +++ b/extensions/memory-core/src/dreaming-narrative.test.ts @@ -29,6 +29,7 @@ import { createMemoryCoreTestHarness } from "./test-helpers.js"; const { createTempWorkspace } = createMemoryCoreTestHarness(); const DREAMS_FILE_LOCKS_KEY = Symbol.for("openclaw.memoryCore.dreamingNarrative.fileLocks"); +const EXPECTS_POSIX_PRIVATE_FILE_MODE = process.platform !== "win32"; afterEach(() => { vi.restoreAllMocks(); @@ -394,7 +395,9 @@ describe("appendNarrativeEntry", () => { }); const stat = await fs.stat(dreamsPath); - expect(stat.mode & 0o777).toBe(0o600); + if (EXPECTS_POSIX_PRIVATE_FILE_MODE) { + expect(stat.mode & 0o777).toBe(0o600); + } }); it("dedupes only exact diary duplicates while keeping distinct timestamps", async () => { diff --git a/extensions/memory-core/src/memory/index.test.ts b/extensions/memory-core/src/memory/index.test.ts index fc55a9078dd..4995e88ee0e 100644 --- a/extensions/memory-core/src/memory/index.test.ts +++ b/extensions/memory-core/src/memory/index.test.ts @@ -172,6 +172,7 @@ describe("memory index", () => { afterEach(async () => { vi.useRealTimers(); + await Promise.all(Array.from(managersForCleanup).map((manager) => manager.close())); await closeAllMemorySearchManagers(); clearRegistry(); managersForCleanup.clear(); diff --git a/extensions/memory-core/src/memory/search-manager.test.ts b/extensions/memory-core/src/memory/search-manager.test.ts index 2052c53a3a3..c160dcc6f64 100644 --- a/extensions/memory-core/src/memory/search-manager.test.ts +++ b/extensions/memory-core/src/memory/search-manager.test.ts @@ -35,6 +35,10 @@ function createManagerStatus(params: { }; } +function nativePath(candidate: string): string { + return path.resolve(candidate); +} + function createManagerMock(params: { backend: "qmd" | "builtin"; provider: string; @@ -339,7 +343,7 @@ describe("getMemorySearchManager caching", () => { expect(checkQmdBinaryAvailability).toHaveBeenCalledWith({ command: "qmd", env: process.env, - cwd: "/tmp/workspace", + cwd: nativePath("/tmp/workspace"), }); }); @@ -430,12 +434,12 @@ describe("getMemorySearchManager caching", () => { expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(1, { command: "qmd", env: process.env, - cwd: "/tmp/workspace-a", + cwd: nativePath("/tmp/workspace-a"), }); expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(2, { command: "qmd", env: process.env, - cwd: "/tmp/workspace-b", + cwd: nativePath("/tmp/workspace-b"), }); }); @@ -582,12 +586,12 @@ describe("getMemorySearchManager caching", () => { expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(1, { command: "qmd", env: process.env, - cwd: "/tmp/workspace-a", + cwd: nativePath("/tmp/workspace-a"), }); expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(2, { command: "qmd", env: process.env, - cwd: "/tmp/workspace-b", + cwd: nativePath("/tmp/workspace-b"), }); }); @@ -637,12 +641,12 @@ describe("getMemorySearchManager caching", () => { expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(1, { command: "qmd", env: process.env, - cwd: "/tmp/workspace", + cwd: nativePath("/tmp/workspace"), }); expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(2, { command: "qmd-alt", env: process.env, - cwd: "/tmp/workspace", + cwd: nativePath("/tmp/workspace"), }); }); @@ -850,12 +854,12 @@ describe("getMemorySearchManager caching", () => { expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(1, { command: "qmd", env: process.env, - cwd: "/tmp/workspace-a", + cwd: nativePath("/tmp/workspace-a"), }); expect(checkQmdBinaryAvailability).toHaveBeenNthCalledWith(2, { command: "qmd", env: process.env, - cwd: "/tmp/workspace-b", + cwd: nativePath("/tmp/workspace-b"), }); const fullAgain = await getMemorySearchManager({ cfg: firstCfg, agentId }); diff --git a/extensions/memory-wiki/src/config.test.ts b/extensions/memory-wiki/src/config.test.ts index df04487763d..f641ac9b558 100644 --- a/extensions/memory-wiki/src/config.test.ts +++ b/extensions/memory-wiki/src/config.test.ts @@ -1,4 +1,5 @@ import fs from "node:fs"; +import path from "node:path"; import AjvPkg from "ajv"; import type { JsonSchemaObject } from "openclaw/plugin-sdk/config-schema"; import { describe, expect, it } from "vitest"; @@ -45,7 +46,7 @@ describe("resolveMemoryWikiConfig", () => { ); expect(config.vaultMode).toBe("bridge"); - expect(config.vault.path).toBe("/Users/tester/vaults/wiki"); + expect(config.vault.path).toBe(path.join("/Users/tester", "vaults", "wiki")); expect(config.vault.renderMode).toBe("obsidian"); }); diff --git a/extensions/memory-wiki/src/query.test.ts b/extensions/memory-wiki/src/query.test.ts index 51ee87eeebf..4968141a704 100644 --- a/extensions/memory-wiki/src/query.test.ts +++ b/extensions/memory-wiki/src/query.test.ts @@ -309,7 +309,7 @@ describe("searchMemoryWiki", () => { config, query: "maintainer-whois", mode: "source-evidence", - maxResults: 2, + maxResults: 5, }); expect(evidenceResults.map((result) => result.path)).toContain("sources/maintainers.md"); });