diff --git a/src/lib/actions/ActionRegistry.spec.ts b/src/lib/actions/ActionRegistry.spec.ts index 47487f85..b00123af 100644 --- a/src/lib/actions/ActionRegistry.spec.ts +++ b/src/lib/actions/ActionRegistry.spec.ts @@ -283,6 +283,16 @@ describe("ActionRegistry.registerCustomActions", () => { contextType: "proc", }) }) + it("should ensure proper action naming", () => { + expect(() => { + actionRegistry.registerCustomActions([ + { + name: "my log", + action: (_ctx, args) => args, + }, + ]) + }).toThrow() + }) }) describe("ActionProvider", () => { diff --git a/src/lib/actions/ActionRegistry.ts b/src/lib/actions/ActionRegistry.ts index 0f0735d0..f03e76de 100644 --- a/src/lib/actions/ActionRegistry.ts +++ b/src/lib/actions/ActionRegistry.ts @@ -86,7 +86,7 @@ export class ActionRegistry { } public registerCustomActions(actions: ActionRegistration[]) { - const nameRegex = "[a-zA-Z0-9]+" + const nameRegex = "^[a-zA-Z0-9]+$" const regex = new RegExp(nameRegex) actions.forEach((customAction) => { if (regex.test(customAction.name)) {