fix: relax slash command parsing

This commit is contained in:
Peter Steinberger
2026-01-08 03:22:14 +01:00
parent 36b443f4f3
commit ad5c87c193
18 changed files with 226 additions and 31 deletions

View File

@@ -9,7 +9,12 @@ describe("control command parsing", () => {
hasCommand: true,
mode: "allow",
});
expect(parseSendPolicyCommand("/send: on")).toEqual({
hasCommand: true,
mode: "allow",
});
expect(parseSendPolicyCommand("/send")).toEqual({ hasCommand: true });
expect(parseSendPolicyCommand("/send:")).toEqual({ hasCommand: true });
expect(parseSendPolicyCommand("send on")).toEqual({ hasCommand: false });
expect(parseSendPolicyCommand("send")).toEqual({ hasCommand: false });
});
@@ -19,6 +24,13 @@ describe("control command parsing", () => {
hasCommand: true,
mode: "mention",
});
expect(parseActivationCommand("/activation: mention")).toEqual({
hasCommand: true,
mode: "mention",
});
expect(parseActivationCommand("/activation:")).toEqual({
hasCommand: true,
});
expect(parseActivationCommand("activation mention")).toEqual({
hasCommand: false,
});
@@ -28,8 +40,10 @@ describe("control command parsing", () => {
expect(hasControlCommand("/send")).toBe(true);
expect(hasControlCommand("send")).toBe(false);
expect(hasControlCommand("/help")).toBe(true);
expect(hasControlCommand("/help:")).toBe(true);
expect(hasControlCommand("help")).toBe(false);
expect(hasControlCommand("/status")).toBe(true);
expect(hasControlCommand("/status:")).toBe(true);
expect(hasControlCommand("status")).toBe(false);
});