mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:50:43 +00:00
test: clarify memory wiki assertions
This commit is contained in:
@@ -3628,13 +3628,11 @@ describe("active-memory plugin", () => {
|
||||
),
|
||||
);
|
||||
expect(
|
||||
vi
|
||||
.mocked(api.logger.info)
|
||||
.mock.calls.some((call: unknown[]) =>
|
||||
String(call[0]).includes(`transcript=${expectedDir}${path.sep}`),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(rmSpy.mock.calls.some(([target]) => String(target).startsWith(expectedDir))).toBe(false);
|
||||
vi.mocked(api.logger.info).mock.calls.map((call: unknown[]) => String(call[0])),
|
||||
).toContainEqual(expect.stringContaining(`transcript=${expectedDir}${path.sep}`));
|
||||
expect(rmSpy.mock.calls.filter(([target]) => String(target).startsWith(expectedDir))).toEqual(
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to the default transcript directory when transcriptDir is unsafe", async () => {
|
||||
|
||||
@@ -59,6 +59,6 @@ describe("buildPageContradictionClusters", () => {
|
||||
|
||||
expect(clusters).toHaveLength(2);
|
||||
expect(clusters.map((cluster) => cluster.key).toSorted()).toEqual(["किताब", "कीताब"]);
|
||||
expect(clusters.every((cluster) => cluster.entries)).toBe(true);
|
||||
expect(clusters.filter((cluster) => !cluster.entries)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -638,8 +638,9 @@ describe("searchMemoryWiki", () => {
|
||||
});
|
||||
|
||||
expect(results).toHaveLength(2);
|
||||
expect(results.some((result) => result.corpus === "wiki")).toBe(true);
|
||||
expect(results.some((result) => result.corpus === "memory")).toBe(true);
|
||||
expect(results.map((result) => result.corpus)).toEqual(
|
||||
expect.arrayContaining(["wiki", "memory"]),
|
||||
);
|
||||
expect(manager.search).toHaveBeenCalledWith("alpha", { maxResults: 5 });
|
||||
expect(getActiveMemorySearchManagerMock).toHaveBeenCalledWith({
|
||||
cfg: createAppConfig(),
|
||||
@@ -691,7 +692,7 @@ describe("searchMemoryWiki", () => {
|
||||
});
|
||||
|
||||
expect(results).toHaveLength(5);
|
||||
expect(results.some((result) => result.corpus === "memory")).toBe(true);
|
||||
expect(results.map((result) => result.corpus)).toContain("memory");
|
||||
expect(
|
||||
results.filter((result) => result.corpus === "wiki").map((result) => result.path),
|
||||
).toEqual([
|
||||
|
||||
Reference in New Issue
Block a user