

























@@ -327,7 +327,7 @@ describe("memory cli", () => {
327327});
328328329329it("resolves configured memory SecretRefs through gateway snapshot", async () => {
330-getRuntimeConfig.mockReturnValue({
330+const config = {
331331agents: {
332332defaults: {
333333memorySearch: {
@@ -337,7 +337,8 @@ describe("memory cli", () => {
337337},
338338},
339339},
340-});
340+};
341+getRuntimeConfig.mockReturnValue(config);
341342const close = vi.fn(async () => {});
342343mockManager({
343344probeVectorAvailability: vi.fn(async () => true),
@@ -347,14 +348,14 @@ describe("memory cli", () => {
347348348349await runMemoryCli(["status"]);
349350350-expect(resolveCommandSecretRefsViaGateway).toHaveBeenCalledWith(
351- expect.objectContaining({
352- commandName: "memory status",
353- targetIds: new Set([
354- "agents.defaults.memorySearch.remote.apiKey",
355- "agents.list[].memorySearch.remote.apiKey",
356-]),
357-}),
351+const secretRefsCall = resolveCommandSecretRefsViaGateway.mock.calls[0]?.[0];
352+expect(secretRefsCall?.config).toBe(config);
353+expect(secretRefsCall?.commandName).toBe("memory status");
354+expect(secretRefsCall?.targetIds).toStrictEqual(
355+new Set([
356+"agents.defaults.memorySearch.remote.apiKey",
357+"agents.list[].memorySearch.remote.apiKey",
358+]),
358359);
359360});
360361@@ -878,7 +879,7 @@ describe("memory cli", () => {
878879879880expect(search).toHaveBeenCalled();
880881expect(close).toHaveBeenCalled();
881-expect(error).toHaveBeenCalledWith(expect.stringContaining("Memory search failed: boom"));
882+expect(error).toHaveBeenCalledWith("Memory search failed: boom");
882883expect(process.exitCode).toBe(1);
883884});
884885@@ -1674,8 +1675,8 @@ describe("memory cli", () => {
16741675expect(memoryText).toContain("Promoted From Short-Term Memory");
16751676expect(memoryText).toContain("openclaw-memory-promotion:");
16761677expect(memoryText).toContain("memory/2026-04-01.md:10-10");
1677-expect(log).toHaveBeenCalledWith(expect.stringContaining("Processed 1 candidate(s) for"));
1678-expect(log).toHaveBeenCalledWith(expect.stringContaining("appended=1 reconciledExisting=0"));
1678+expectLogged(log, `Processed 1 candidate(s) for ${memoryPath}.`);
1679+expectLogged(log, "appended=1 reconciledExisting=0");
16791680expect(close).toHaveBeenCalled();
16801681});
16811682});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。