mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:38:28 +00:00
auto-reply: enrich chat status
This commit is contained in:
@@ -3,6 +3,13 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import * as tauRpc from "../process/tau-rpc.js";
|
||||
import { getReplyFromConfig } from "./reply.js";
|
||||
|
||||
const webMocks = vi.hoisted(() => ({
|
||||
webAuthExists: vi.fn().mockResolvedValue(true),
|
||||
getWebAuthAgeMs: vi.fn().mockReturnValue(120_000),
|
||||
}));
|
||||
|
||||
vi.mock("../web/session.js", () => webMocks);
|
||||
|
||||
const baseCfg = {
|
||||
inbound: {
|
||||
reply: {
|
||||
@@ -52,6 +59,23 @@ describe("trigger handling", () => {
|
||||
expect(runner).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("reports status without invoking the agent", async () => {
|
||||
const runner = vi.fn();
|
||||
const res = await getReplyFromConfig(
|
||||
{
|
||||
Body: "/status",
|
||||
From: "+1002",
|
||||
To: "+2000",
|
||||
},
|
||||
{},
|
||||
baseCfg,
|
||||
runner,
|
||||
);
|
||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||
expect(text).toContain("Status");
|
||||
expect(runner).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("ignores think directives that only appear in the context wrapper", async () => {
|
||||
const rpcMock = vi.spyOn(tauRpc, "runPiRpc").mockResolvedValue({
|
||||
stdout:
|
||||
|
||||
Reference in New Issue
Block a user