Files
oh-my-pi/packages/coding-agent/test/memory-backend-resolve.test.ts
T
can1357 d57275fb5d feat(coding-agent): made memory.backend the authoritative selector for memory backends
- Updated runtime memory config loading and backend resolution so `memory.backend === "local"` now enables the local pipeline directly, while `memories.enabled` is treated only as a legacy migration input.
- Switched the `memory.backend` default to `off` and kept `memories.enabled` hidden from the Memory tab UI for migration compatibility.
- Adjusted memory runtime, resolver, and documentation/tests to match the new backend-selection semantics.
2026-05-03 07:39:52 +02:00

31 lines
1.2 KiB
TypeScript

import { afterEach, beforeEach, describe, expect, it } from "bun:test";
import { _resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import { resolveMemoryBackend } from "@oh-my-pi/pi-coding-agent/memory-backend";
describe("resolveMemoryBackend", () => {
beforeEach(() => {
_resetSettingsForTest();
});
afterEach(() => {
_resetSettingsForTest();
});
it("returns the off backend when memory.backend is off", () => {
const settings = Settings.isolated({ "memory.backend": "off" });
expect(resolveMemoryBackend(settings).id).toBe("off");
});
it("returns the local backend when memory.backend is local", () => {
const settings = Settings.isolated({ "memory.backend": "local", "memories.enabled": false });
expect(resolveMemoryBackend(settings).id).toBe("local");
});
it("returns the hindsight backend when memory.backend is hindsight, regardless of legacy memories.enabled", () => {
const a = Settings.isolated({ "memory.backend": "hindsight", "memories.enabled": false });
const b = Settings.isolated({ "memory.backend": "hindsight", "memories.enabled": true });
expect(resolveMemoryBackend(a).id).toBe("hindsight");
expect(resolveMemoryBackend(b).id).toBe("hindsight");
});
});