mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
test: avoid fake session mtime fixture
This commit is contained in:
@@ -140,14 +140,14 @@ describe("temporal decay", () => {
|
||||
|
||||
it("uses file mtime fallback for non-memory sources", async () => {
|
||||
const dir = await createTempWorkspace("openclaw-temporal-decay-");
|
||||
const sessionPath = path.join(dir, "sessions", "thread.jsonl");
|
||||
await fs.mkdir(path.dirname(sessionPath), { recursive: true });
|
||||
await fs.writeFile(sessionPath, "{}\n");
|
||||
const sourcePath = path.join(dir, "sources", "thread.txt");
|
||||
await fs.mkdir(path.dirname(sourcePath), { recursive: true });
|
||||
await fs.writeFile(sourcePath, "source\n");
|
||||
const oldMtime = new Date(NOW_MS - 30 * DAY_MS);
|
||||
await fs.utimes(sessionPath, oldMtime, oldMtime);
|
||||
await fs.utimes(sourcePath, oldMtime, oldMtime);
|
||||
|
||||
const decayed = await applyTemporalDecayToHybridResults({
|
||||
results: [{ path: "sessions/thread.jsonl", score: 1, source: "sessions" }],
|
||||
results: [{ path: "sources/thread.txt", score: 1, source: "external" }],
|
||||
workspaceDir: dir,
|
||||
temporalDecay: { enabled: true, halfLifeDays: 30 },
|
||||
nowMs: NOW_MS,
|
||||
|
||||
Reference in New Issue
Block a user