Slack: accept slash command names with or without leading slash
Closes #798
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { isSlackRoomAllowedByPolicy, resolveSlackThreadTs } from "./monitor.js";
|
||||
import {
|
||||
buildSlackSlashCommandMatcher,
|
||||
isSlackRoomAllowedByPolicy,
|
||||
resolveSlackThreadTs,
|
||||
} from "./monitor.js";
|
||||
|
||||
describe("slack groupPolicy gating", () => {
|
||||
it("allows when policy is open", () => {
|
||||
@@ -152,3 +156,19 @@ describe("resolveSlackThreadTs", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildSlackSlashCommandMatcher", () => {
|
||||
it("matches with or without a leading slash", () => {
|
||||
const matcher = buildSlackSlashCommandMatcher("clawd");
|
||||
|
||||
expect(matcher.test("clawd")).toBe(true);
|
||||
expect(matcher.test("/clawd")).toBe(true);
|
||||
});
|
||||
|
||||
it("does not match similar names", () => {
|
||||
const matcher = buildSlackSlashCommandMatcher("clawd");
|
||||
|
||||
expect(matcher.test("/clawd-bot")).toBe(false);
|
||||
expect(matcher.test("clawd-bot")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user