mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 20:14:44 +00:00
test: list onboarding hook notes
This commit is contained in:
@@ -134,6 +134,10 @@ describe("onboard-hooks", () => {
|
||||
}
|
||||
|
||||
describe("setupInternalHooks", () => {
|
||||
beforeEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it("should enable hooks when user selects them", async () => {
|
||||
const { result, prompter } = await runSetupInternalHooks({
|
||||
selected: ["session-memory"],
|
||||
@@ -221,20 +225,35 @@ describe("onboard-hooks", () => {
|
||||
});
|
||||
|
||||
it("should show informative notes to user", async () => {
|
||||
vi.stubEnv("OPENCLAW_CONTAINER_HINT", "");
|
||||
vi.stubEnv("OPENCLAW_PROFILE", "");
|
||||
const { prompter } = await runSetupInternalHooks({
|
||||
selected: ["session-memory"],
|
||||
});
|
||||
|
||||
const noteCalls = (prompter.note as ReturnType<typeof vi.fn>).mock.calls;
|
||||
expect(noteCalls).toHaveLength(2);
|
||||
|
||||
// First note should explain what hooks are
|
||||
expect(noteCalls[0][0]).toContain("Hooks let you automate actions");
|
||||
expect(noteCalls[0][0]).toContain("automate actions");
|
||||
|
||||
// Second note should confirm configuration
|
||||
expect(noteCalls[1][0]).toContain("Enabled 1 hook: session-memory");
|
||||
expect(noteCalls[1][0]).toMatch(/(?:openclaw|openclaw)( --profile isolated)? hooks list/);
|
||||
expect(noteCalls).toEqual([
|
||||
[
|
||||
[
|
||||
"Hooks let you automate actions when agent commands are issued.",
|
||||
"Example: Save session context to memory when you issue /new or /reset.",
|
||||
"",
|
||||
"Learn more: https://docs.openclaw.ai/automation/hooks",
|
||||
].join("\n"),
|
||||
"Hooks",
|
||||
],
|
||||
[
|
||||
[
|
||||
"Enabled 1 hook: session-memory",
|
||||
"",
|
||||
"You can manage hooks later with:",
|
||||
" openclaw hooks list",
|
||||
" openclaw hooks enable <name>",
|
||||
" openclaw hooks disable <name>",
|
||||
].join("\n"),
|
||||
"Hooks Configured",
|
||||
],
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user