mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:10:45 +00:00
test(commands): share memory recall doctor mock setup
This commit is contained in:
@@ -80,6 +80,47 @@ import { noteMemorySearchHealth } from "./doctor-memory-search.js";
|
||||
import { maybeRepairMemoryRecallHealth, noteMemoryRecallHealth } from "./doctor-memory-search.js";
|
||||
import { detectLegacyWorkspaceDirs } from "./doctor-workspace.js";
|
||||
|
||||
function resetMemoryRecallMocks() {
|
||||
auditShortTermPromotionArtifacts.mockReset();
|
||||
auditShortTermPromotionArtifacts.mockResolvedValue({
|
||||
storePath: "/tmp/agent-default/workspace/memory/.dreams/short-term-recall.json",
|
||||
lockPath: "/tmp/agent-default/workspace/memory/.dreams/short-term-promotion.lock",
|
||||
exists: true,
|
||||
entryCount: 1,
|
||||
promotedCount: 0,
|
||||
spacedEntryCount: 0,
|
||||
conceptTaggedEntryCount: 1,
|
||||
invalidEntryCount: 0,
|
||||
issues: [],
|
||||
});
|
||||
auditDreamingArtifacts.mockReset();
|
||||
auditDreamingArtifacts.mockResolvedValue({
|
||||
sessionCorpusDir: "/tmp/agent-default/workspace/memory/.dreams/session-corpus",
|
||||
sessionCorpusFileCount: 0,
|
||||
suspiciousSessionCorpusFileCount: 0,
|
||||
suspiciousSessionCorpusLineCount: 0,
|
||||
sessionIngestionPath: "/tmp/agent-default/workspace/memory/.dreams/session-ingestion.json",
|
||||
sessionIngestionExists: false,
|
||||
issues: [],
|
||||
});
|
||||
repairDreamingArtifacts.mockReset();
|
||||
repairDreamingArtifacts.mockResolvedValue({
|
||||
changed: false,
|
||||
archivedDreamsDiary: false,
|
||||
archivedSessionCorpus: false,
|
||||
archivedSessionIngestion: false,
|
||||
archivedPaths: [],
|
||||
warnings: [],
|
||||
});
|
||||
repairShortTermPromotionArtifacts.mockReset();
|
||||
repairShortTermPromotionArtifacts.mockResolvedValue({
|
||||
changed: false,
|
||||
removedInvalidEntries: 0,
|
||||
rewroteStore: false,
|
||||
removedStaleLock: false,
|
||||
});
|
||||
}
|
||||
|
||||
describe("noteMemorySearchHealth", () => {
|
||||
const cfg = {} as OpenClawConfig;
|
||||
|
||||
@@ -115,44 +156,7 @@ describe("noteMemorySearchHealth", () => {
|
||||
});
|
||||
checkQmdBinaryAvailability.mockReset();
|
||||
checkQmdBinaryAvailability.mockResolvedValue({ available: true });
|
||||
auditShortTermPromotionArtifacts.mockReset();
|
||||
auditShortTermPromotionArtifacts.mockResolvedValue({
|
||||
storePath: "/tmp/agent-default/workspace/memory/.dreams/short-term-recall.json",
|
||||
lockPath: "/tmp/agent-default/workspace/memory/.dreams/short-term-promotion.lock",
|
||||
exists: true,
|
||||
entryCount: 1,
|
||||
promotedCount: 0,
|
||||
spacedEntryCount: 0,
|
||||
conceptTaggedEntryCount: 1,
|
||||
invalidEntryCount: 0,
|
||||
issues: [],
|
||||
});
|
||||
auditDreamingArtifacts.mockReset();
|
||||
auditDreamingArtifacts.mockResolvedValue({
|
||||
sessionCorpusDir: "/tmp/agent-default/workspace/memory/.dreams/session-corpus",
|
||||
sessionCorpusFileCount: 0,
|
||||
suspiciousSessionCorpusFileCount: 0,
|
||||
suspiciousSessionCorpusLineCount: 0,
|
||||
sessionIngestionPath: "/tmp/agent-default/workspace/memory/.dreams/session-ingestion.json",
|
||||
sessionIngestionExists: false,
|
||||
issues: [],
|
||||
});
|
||||
repairDreamingArtifacts.mockReset();
|
||||
repairDreamingArtifacts.mockResolvedValue({
|
||||
changed: false,
|
||||
archivedDreamsDiary: false,
|
||||
archivedSessionCorpus: false,
|
||||
archivedSessionIngestion: false,
|
||||
archivedPaths: [],
|
||||
warnings: [],
|
||||
});
|
||||
repairShortTermPromotionArtifacts.mockReset();
|
||||
repairShortTermPromotionArtifacts.mockResolvedValue({
|
||||
changed: false,
|
||||
removedInvalidEntries: 0,
|
||||
rewroteStore: false,
|
||||
removedStaleLock: false,
|
||||
});
|
||||
resetMemoryRecallMocks();
|
||||
});
|
||||
|
||||
it("does not warn when local provider is set with no explicit modelPath (default model fallback)", async () => {
|
||||
@@ -452,44 +456,7 @@ describe("memory recall doctor integration", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
note.mockClear();
|
||||
auditShortTermPromotionArtifacts.mockReset();
|
||||
auditShortTermPromotionArtifacts.mockResolvedValue({
|
||||
storePath: "/tmp/agent-default/workspace/memory/.dreams/short-term-recall.json",
|
||||
lockPath: "/tmp/agent-default/workspace/memory/.dreams/short-term-promotion.lock",
|
||||
exists: true,
|
||||
entryCount: 1,
|
||||
promotedCount: 0,
|
||||
spacedEntryCount: 0,
|
||||
conceptTaggedEntryCount: 1,
|
||||
invalidEntryCount: 0,
|
||||
issues: [],
|
||||
});
|
||||
auditDreamingArtifacts.mockReset();
|
||||
auditDreamingArtifacts.mockResolvedValue({
|
||||
sessionCorpusDir: "/tmp/agent-default/workspace/memory/.dreams/session-corpus",
|
||||
sessionCorpusFileCount: 0,
|
||||
suspiciousSessionCorpusFileCount: 0,
|
||||
suspiciousSessionCorpusLineCount: 0,
|
||||
sessionIngestionPath: "/tmp/agent-default/workspace/memory/.dreams/session-ingestion.json",
|
||||
sessionIngestionExists: false,
|
||||
issues: [],
|
||||
});
|
||||
repairDreamingArtifacts.mockReset();
|
||||
repairDreamingArtifacts.mockResolvedValue({
|
||||
changed: false,
|
||||
archivedDreamsDiary: false,
|
||||
archivedSessionCorpus: false,
|
||||
archivedSessionIngestion: false,
|
||||
archivedPaths: [],
|
||||
warnings: [],
|
||||
});
|
||||
repairShortTermPromotionArtifacts.mockReset();
|
||||
repairShortTermPromotionArtifacts.mockResolvedValue({
|
||||
changed: false,
|
||||
removedInvalidEntries: 0,
|
||||
rewroteStore: false,
|
||||
removedStaleLock: false,
|
||||
});
|
||||
resetMemoryRecallMocks();
|
||||
});
|
||||
|
||||
function createPrompter(overrides: Partial<DoctorPrompter> = {}): DoctorPrompter {
|
||||
|
||||
Reference in New Issue
Block a user