mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-23 07:51:33 +00:00
Merged via squash.
Prepared head SHA: 5228d1937f
Co-authored-by: jarimustonen <1272053+jarimustonen@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildPromptSection } from "./index.js";
|
|
|
|
describe("buildPromptSection", () => {
|
|
it("returns empty when no memory tools are available", () => {
|
|
expect(buildPromptSection({ availableTools: new Set() })).toEqual([]);
|
|
});
|
|
|
|
it("returns Memory Recall section when memory_search is available", () => {
|
|
const result = buildPromptSection({ availableTools: new Set(["memory_search"]) });
|
|
expect(result[0]).toBe("## Memory Recall");
|
|
expect(result).toContain(
|
|
"Citations: include Source: <path#line> when it helps the user verify memory snippets.",
|
|
);
|
|
expect(result.at(-1)).toBe("");
|
|
});
|
|
|
|
it("returns Memory Recall section when memory_get is available", () => {
|
|
const result = buildPromptSection({ availableTools: new Set(["memory_get"]) });
|
|
expect(result[0]).toBe("## Memory Recall");
|
|
});
|
|
|
|
it("includes citations-off instruction when citationsMode is off", () => {
|
|
const result = buildPromptSection({
|
|
availableTools: new Set(["memory_search"]),
|
|
citationsMode: "off",
|
|
});
|
|
expect(result).toContain(
|
|
"Citations are disabled: do not mention file paths or line numbers in replies unless the user explicitly asks.",
|
|
);
|
|
});
|
|
});
|