mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:41:36 +00:00
feat: improve gateway services and auto-reply commands
This commit is contained in:
@@ -4,7 +4,9 @@ import {
|
||||
buildCommandText,
|
||||
getCommandDetection,
|
||||
listChatCommands,
|
||||
listChatCommandsForConfig,
|
||||
listNativeCommandSpecs,
|
||||
listNativeCommandSpecsForConfig,
|
||||
shouldHandleTextCommands,
|
||||
} from "./commands-registry.js";
|
||||
|
||||
@@ -21,6 +23,26 @@ describe("commands registry", () => {
|
||||
expect(specs.find((spec) => spec.name === "compact")).toBeFalsy();
|
||||
});
|
||||
|
||||
it("filters commands based on config flags", () => {
|
||||
const disabled = listChatCommandsForConfig({
|
||||
commands: { config: false, debug: false },
|
||||
});
|
||||
expect(disabled.find((spec) => spec.key === "config")).toBeFalsy();
|
||||
expect(disabled.find((spec) => spec.key === "debug")).toBeFalsy();
|
||||
|
||||
const enabled = listChatCommandsForConfig({
|
||||
commands: { config: true, debug: true },
|
||||
});
|
||||
expect(enabled.find((spec) => spec.key === "config")).toBeTruthy();
|
||||
expect(enabled.find((spec) => spec.key === "debug")).toBeTruthy();
|
||||
|
||||
const nativeDisabled = listNativeCommandSpecsForConfig({
|
||||
commands: { config: false, debug: false, native: true },
|
||||
});
|
||||
expect(nativeDisabled.find((spec) => spec.name === "config")).toBeFalsy();
|
||||
expect(nativeDisabled.find((spec) => spec.name === "debug")).toBeFalsy();
|
||||
});
|
||||
|
||||
it("detects known text commands", () => {
|
||||
const detection = getCommandDetection();
|
||||
expect(detection.exact.has("/commands")).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user