test: tighten memory empty array assertions

This commit is contained in:
Shakker
2026-05-09 05:02:12 +01:00
parent bef9f75f05
commit 3ce49c0acb
12 changed files with 34 additions and 34 deletions

View File

@@ -10,7 +10,7 @@ import { buildPromptSection } from "./src/prompt-section.js";
describe("buildPromptSection", () => {
it("returns empty when no memory tools are available", () => {
expect(buildPromptSection({ availableTools: new Set() })).toEqual([]);
expect(buildPromptSection({ availableTools: new Set() })).toStrictEqual([]);
});
it("describes the two-step flow when both memory tools are available", () => {

View File

@@ -2766,7 +2766,7 @@ describe("previewRemHarness", () => {
},
});
expect(preview.groundedInputPaths).toEqual([]);
expect(preview.groundedInputPaths).toStrictEqual([]);
expect(preview.grounded).toBeNull();
});
@@ -2803,8 +2803,8 @@ describe("previewRemHarness", () => {
});
expect(preview.remSkipped).toBe(true);
expect(preview.rem.candidateTruths).toEqual([]);
expect(preview.rem.bodyLines).toEqual([]);
expect(preview.rem.candidateTruths).toStrictEqual([]);
expect(preview.rem.bodyLines).toStrictEqual([]);
expect(preview.deep.candidates[0]?.snippet).toContain("Always check weather");
});
});

View File

@@ -86,7 +86,7 @@ describe("dreaming artifact repair", () => {
expect(audit.suspiciousSessionCorpusFileCount).toBe(0);
expect(audit.suspiciousSessionCorpusLineCount).toBe(0);
expect(audit.issues).toEqual([]);
expect(audit.issues).toStrictEqual([]);
});
it("rejects relative workspace paths during audit and repair", async () => {

View File

@@ -428,7 +428,7 @@ describe("memory index", () => {
const available = await manager.probeVectorStoreAvailability?.();
const status = manager.status();
expect(providerCalls).toEqual([]);
expect(providerCalls).toStrictEqual([]);
expect(typeof status.vector?.storeAvailable).toBe("boolean");
expect(status.vector?.storeAvailable).toBe(available);
expect(status.vector?.semanticAvailable).toBeUndefined();

View File

@@ -56,7 +56,7 @@ describe("memory source state", () => {
});
expect(hash).toBe("hash-from-snapshot");
expect(calls).toEqual([]);
expect(calls).toStrictEqual([]);
});
it("falls back to per-file lookups without a bulk snapshot", () => {

View File

@@ -152,9 +152,9 @@ describe("session archive delta bypass", () => {
await harness.processPendingSessionDeltas();
expect(harness.getDirtySessionFiles()).toEqual([]);
expect(harness.getDirtySessionFiles()).toStrictEqual([]);
expect(harness.isSessionsDirty()).toBe(false);
expect(harness.syncCalls).toEqual([]);
expect(harness.syncCalls).toStrictEqual([]);
});
it("keeps live transcripts below the configured thresholds", async () => {
@@ -164,8 +164,8 @@ describe("session archive delta bypass", () => {
await harness.processPendingSessionDeltas();
expect(harness.getDirtySessionFiles()).toEqual([]);
expect(harness.getDirtySessionFiles()).toStrictEqual([]);
expect(harness.isSessionsDirty()).toBe(false);
expect(harness.syncCalls).toEqual([]);
expect(harness.syncCalls).toStrictEqual([]);
});
});

View File

@@ -184,8 +184,8 @@ describe("computeMMRScore", () => {
describe("empty input behavior", () => {
it("returns empty array for empty input", () => {
expect(mmrRerank([])).toEqual([]);
expect(applyMMRToHybridResults([])).toEqual([]);
expect(mmrRerank([])).toStrictEqual([]);
expect(applyMMRToHybridResults([])).toStrictEqual([]);
});
});

View File

@@ -396,7 +396,7 @@ describe("QmdMemoryManager", () => {
const searchPromise = manager.search("hello", { sessionKey: "session-b" });
await vi.advanceTimersByTimeAsync(500);
await expect(searchPromise).resolves.toEqual([]);
await expect(searchPromise).resolves.toStrictEqual([]);
(
releaseUpdate ??
@@ -534,7 +534,7 @@ describe("QmdMemoryManager", () => {
const updateCalls = spawnMock.mock.calls
.map((call: unknown[]) => call[1] as string[])
.filter((args: string[]) => args[0] === "update" || args[0] === "embed");
expect(updateCalls).toEqual([]);
expect(updateCalls).toStrictEqual([]);
await manager?.close();
});
@@ -1637,7 +1637,7 @@ describe("QmdMemoryManager", () => {
await expect(
manager.search("test", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const searchCall = spawnMock.mock.calls.find(
(call: unknown[]) => (call[1] as string[])?.[0] === "search",
@@ -1822,7 +1822,7 @@ describe("QmdMemoryManager", () => {
await expect(
manager.search("記憶系統升級 QMD", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const searchCall = spawnMock.mock.calls.find(
(call: unknown[]) => (call[1] as string[])?.[0] === "search",
@@ -1899,7 +1899,7 @@ describe("QmdMemoryManager", () => {
const query = "自然 高级感 结论先行 搜索偏好";
await expect(
manager.search(query, { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const searchCall = spawnMock.mock.calls.find(
(call: unknown[]) => (call[1] as string[])?.[0] === "search",
@@ -1933,7 +1933,7 @@ describe("QmdMemoryManager", () => {
const { manager } = await createManager();
await expect(
manager.search("記憶系統升級 QMD", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const queryCall = spawnMock.mock.calls.find(
(call: unknown[]) => (call[1] as string[])?.[0] === "query",
@@ -1977,7 +1977,7 @@ describe("QmdMemoryManager", () => {
await expect(
manager.search("test", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const searchAndQueryCalls = spawnMock.mock.calls
.map((call: unknown[]) => call[1])
@@ -2377,7 +2377,7 @@ describe("QmdMemoryManager", () => {
await expect(
manager.search("test", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const queryCalls = spawnMock.mock.calls
.map((call: unknown[]) => call[1] as string[])
@@ -2428,7 +2428,7 @@ describe("QmdMemoryManager", () => {
await expect(
manager.search("test", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const searchAndQueryCalls = spawnMock.mock.calls
.map((call: unknown[]) => call[1] as string[])
@@ -2470,7 +2470,7 @@ describe("QmdMemoryManager", () => {
logWarnMock.mockClear();
await expect(
manager.search("hello", { sessionKey: "agent:main:slack:dm:u123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
const mcporterCalls = spawnMock.mock.calls.filter((call: unknown[]) =>
isMcporterCommand(call[0]),
@@ -2973,7 +2973,7 @@ describe("QmdMemoryManager", () => {
manager.search("abc: Tool query not found", {
sessionKey: "agent:main:slack:dm:u123",
}),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
await manager.search("hello again", { sessionKey: "agent:main:slack:dm:u123" });
@@ -3322,7 +3322,7 @@ describe("QmdMemoryManager", () => {
const { manager } = await createManager();
const results = await manager.search("test", { sessionKey: "agent:main:slack:dm:u123" });
expect(results).toEqual([]);
expect(results).toStrictEqual([]);
expect(
spawnMock.mock.calls.some((call: unknown[]) => (call[1] as string[])?.[0] === "query"),
).toBe(false);
@@ -3575,7 +3575,7 @@ describe("QmdMemoryManager", () => {
const commandCalls = spawnMock.mock.calls
.map((call: unknown[]) => call[1] as string[])
.filter((args: string[]) => args[0] === "update" || args[0] === "embed");
expect(commandCalls).toEqual([]);
expect(commandCalls).toStrictEqual([]);
await manager.close();
});
@@ -3989,7 +3989,7 @@ describe("QmdMemoryManager", () => {
const beforeCalls = spawnMock.mock.calls.length;
await expect(
manager.search("blocked", { sessionKey: "agent:main:discord:channel:c123" }),
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
expect(spawnMock.mock.calls.length).toBe(beforeCalls);
expect(logWarnMock).toHaveBeenCalledWith(expect.stringContaining("qmd search denied by scope"));
@@ -4723,7 +4723,7 @@ describe("QmdMemoryManager", () => {
await expect(
manager.search("missing", { sessionKey: "agent:main:slack:dm:u123" }),
testCase.name,
).resolves.toEqual([]);
).resolves.toStrictEqual([]);
await manager.close();
}
});

View File

@@ -575,7 +575,7 @@ describe("getMemorySearchManager caching", () => {
expect(replacementAttempt.manager).toBe(fallbackManager);
expect(firstPrimary.close).not.toHaveBeenCalled();
await expect(firstManager.search("hello")).resolves.toEqual([]);
await expect(firstManager.search("hello")).resolves.toStrictEqual([]);
const firstAgain = await getMemorySearchManager({ cfg: firstCfg, agentId });
expect(firstAgain.manager).toBe(firstManager);

View File

@@ -98,6 +98,6 @@ describe("listMemoryCorePublicArtifacts", () => {
},
};
await expect(listMemoryCorePublicArtifacts({ cfg })).resolves.toEqual([]);
await expect(listMemoryCorePublicArtifacts({ cfg })).resolves.toStrictEqual([]);
});
});

View File

@@ -49,7 +49,7 @@ describe("filterMemorySearchHitsBySessionVisibility", () => {
sandboxed: false,
hits,
});
expect(filtered).toEqual([]);
expect(filtered).toStrictEqual([]);
});
it("keeps non-session hits unchanged", async () => {
@@ -148,7 +148,7 @@ describe("filterMemorySearchHitsBySessionVisibility", () => {
sandboxed: false,
hits: [hit],
});
expect(filtered).toEqual([]);
expect(filtered).toStrictEqual([]);
});
it("keeps same-agent deleted archive hits using owner metadata when the live store entry is gone", async () => {
@@ -201,6 +201,6 @@ describe("filterMemorySearchHitsBySessionVisibility", () => {
hits: [hit],
});
expect(filtered).toEqual([]);
expect(filtered).toStrictEqual([]);
});
});

View File

@@ -1093,7 +1093,7 @@ describe("short-term promotion", () => {
minUniqueQueries: 0,
});
expect(ranked).toEqual([]);
expect(ranked).toStrictEqual([]);
});
});