mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 20:34:31 +00:00
test: align remaining trigger configs with fast harness defaults
This commit is contained in:
@@ -37,6 +37,8 @@ describe("trigger handling", () => {
|
|||||||
it("runs /compact as a gated command", async () => {
|
it("runs /compact as a gated command", async () => {
|
||||||
await withTempHome(async (home) => {
|
await withTempHome(async (home) => {
|
||||||
const storePath = join(tmpdir(), `openclaw-session-test-${Date.now()}.json`);
|
const storePath = join(tmpdir(), `openclaw-session-test-${Date.now()}.json`);
|
||||||
|
const cfg = makeCfg(home);
|
||||||
|
cfg.session = { ...cfg.session, store: storePath };
|
||||||
mockSuccessfulCompaction();
|
mockSuccessfulCompaction();
|
||||||
|
|
||||||
const res = await getReplyFromConfig(
|
const res = await getReplyFromConfig(
|
||||||
@@ -47,22 +49,7 @@ describe("trigger handling", () => {
|
|||||||
CommandAuthorized: true,
|
CommandAuthorized: true,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
{
|
cfg,
|
||||||
agents: {
|
|
||||||
defaults: {
|
|
||||||
model: { primary: "anthropic/claude-opus-4-5" },
|
|
||||||
workspace: join(home, "openclaw"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
channels: {
|
|
||||||
whatsapp: {
|
|
||||||
allowFrom: ["*"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
session: {
|
|
||||||
store: storePath,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
const text = replyText(res);
|
const text = replyText(res);
|
||||||
expect(text?.startsWith("⚙️ Compacted")).toBe(true);
|
expect(text?.startsWith("⚙️ Compacted")).toBe(true);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { beforeAll, describe, expect, it } from "vitest";
|
|||||||
import {
|
import {
|
||||||
getRunEmbeddedPiAgentMock,
|
getRunEmbeddedPiAgentMock,
|
||||||
installTriggerHandlingE2eTestHooks,
|
installTriggerHandlingE2eTestHooks,
|
||||||
|
makeCfg,
|
||||||
runGreetingPromptForBareNewOrReset,
|
runGreetingPromptForBareNewOrReset,
|
||||||
withTempHome,
|
withTempHome,
|
||||||
} from "./reply.triggers.trigger-handling.test-harness.js";
|
} from "./reply.triggers.trigger-handling.test-harness.js";
|
||||||
@@ -21,6 +22,16 @@ async function expectResetBlockedForNonOwner(params: {
|
|||||||
getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
|
getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const { home, commandAuthorized, getReplyFromConfig } = params;
|
const { home, commandAuthorized, getReplyFromConfig } = params;
|
||||||
|
const cfg = makeCfg(home);
|
||||||
|
cfg.channels ??= {};
|
||||||
|
cfg.channels.whatsapp = {
|
||||||
|
...cfg.channels.whatsapp,
|
||||||
|
allowFrom: ["+1999"],
|
||||||
|
};
|
||||||
|
cfg.session = {
|
||||||
|
...cfg.session,
|
||||||
|
store: join(tmpdir(), `openclaw-session-test-${Date.now()}.json`),
|
||||||
|
};
|
||||||
const res = await getReplyFromConfig(
|
const res = await getReplyFromConfig(
|
||||||
{
|
{
|
||||||
Body: "/reset",
|
Body: "/reset",
|
||||||
@@ -29,22 +40,7 @@ async function expectResetBlockedForNonOwner(params: {
|
|||||||
CommandAuthorized: commandAuthorized,
|
CommandAuthorized: commandAuthorized,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
{
|
cfg,
|
||||||
agents: {
|
|
||||||
defaults: {
|
|
||||||
model: { primary: "anthropic/claude-opus-4-5" },
|
|
||||||
workspace: join(home, "openclaw"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
channels: {
|
|
||||||
whatsapp: {
|
|
||||||
allowFrom: ["+1999"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
session: {
|
|
||||||
store: join(tmpdir(), `openclaw-session-test-${Date.now()}.json`),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
expect(res).toBeUndefined();
|
expect(res).toBeUndefined();
|
||||||
expect(getRunEmbeddedPiAgentMock()).not.toHaveBeenCalled();
|
expect(getRunEmbeddedPiAgentMock()).not.toHaveBeenCalled();
|
||||||
|
|||||||
Reference in New Issue
Block a user