Files
openclaw/src/auto-reply/reply/commands-context.test.ts
Vincent Koc 5369ea53be perf(inbound): trim dispatch and command startup imports (#52374)
* perf(inbound): trim dispatch and command startup imports

* fix(reply): restore command alias canonicalization

* style(reply): format command context

* fix(reply): restore runtime shim exports

* test(reply): mock ACP route seam

* fix(reply): repair dispatch type seams
2026-03-22 13:19:57 -07:00

30 lines
818 B
TypeScript

import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../config/config.js";
import { buildCommandContext } from "./commands-context.js";
import { buildTestCtx } from "./test-ctx.js";
describe("buildCommandContext", () => {
it("canonicalizes registered aliases like /id to their primary command", () => {
const ctx = buildTestCtx({
Provider: "discord",
Surface: "discord",
From: "user",
To: "bot",
Body: "/id",
RawBody: "/id",
CommandBody: "/id",
BodyForCommands: "/id",
});
const result = buildCommandContext({
ctx,
cfg: {} as OpenClawConfig,
isGroup: false,
triggerBodyNormalized: "/id",
commandAuthorized: true,
});
expect(result.commandBodyNormalized).toBe("/whoami");
});
});