mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 03:41:51 +00:00
* 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
30 lines
818 B
TypeScript
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");
|
|
});
|
|
});
|