The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
import { describe, expect, it } from "vitest";
import { matchSafeQuestionValidationPattern } from "./question-validation-pattern";
describe("matchSafeQuestionValidationPattern", () => {
it("matches the bounded fixed-width subset without a dynamic RegExp", () => {
expect(matchSafeQuestionValidationPattern("^#[0-9A-F][0-9A-F]$", "#2F"))
.toBe("match");
expect(matchSafeQuestionValidationPattern("^#[0-9A-F][0-9A-F]$", "#GG"))
.toBe("no_match");
expect(matchSafeQuestionValidationPattern("^item\\.\\d$", "item.7"))
.toBe("match");
});
it("rejects provider patterns that can trigger backtracking", () => {
expect(
matchSafeQuestionValidationPattern("^(a+)+$", `${"a".repeat(50_000)}!`),
).toBe("unsupported");
expect(matchSafeQuestionValidationPattern("^[a-z]*[a-z]*$", "abc"))
.toBe("unsupported");
expect(matchSafeQuestionValidationPattern("[a-z]", "a"))
.toBe("unsupported");
});
});