mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:18:26 +00:00
test(hooks): stabilize session-memory hook tests
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../../../config/config.js";
|
||||
import type { HookHandler } from "../../hooks.js";
|
||||
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
|
||||
import { createHookEvent } from "../../hooks.js";
|
||||
import handler from "./handler.js";
|
||||
|
||||
// Avoid calling the embedded Pi agent (global command lane); keep this unit test deterministic.
|
||||
vi.mock("../../llm-slug-generator.js", () => ({
|
||||
generateSlugViaLLM: vi.fn().mockResolvedValue("simple-math"),
|
||||
}));
|
||||
|
||||
let handler: HookHandler;
|
||||
|
||||
beforeAll(async () => {
|
||||
({ default: handler } = await import("./handler.js"));
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a mock session JSONL file with various entry types
|
||||
|
||||
Reference in New Issue
Block a user