mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
Limit workflow ID conditions to equality
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { test } from "node:test";
|
||||
import {
|
||||
buildConditionExpression,
|
||||
conditionFieldsForTrigger,
|
||||
conditionOperatorsForField,
|
||||
normalizeWebhookField,
|
||||
parseConditionExpression,
|
||||
} from "./workflowConditionExpression.ts";
|
||||
@@ -77,6 +78,21 @@ test("shows trigger-relevant fields", () => {
|
||||
assert.equal(conditionFieldsForTrigger("webhook")[0].value, "webhook_field");
|
||||
});
|
||||
|
||||
test("limits opaque identifiers to equality operators", () => {
|
||||
for (const field of [
|
||||
"trigger_author",
|
||||
"trigger_channel_id",
|
||||
"trigger_message_id",
|
||||
"future_resource_id",
|
||||
]) {
|
||||
assert.deepEqual(conditionOperatorsForField(field), [
|
||||
"equals",
|
||||
"not_equals",
|
||||
]);
|
||||
}
|
||||
assert.equal(conditionOperatorsForField("trigger_text").length, 8);
|
||||
});
|
||||
|
||||
test("parses generated conditions back into editor fields", () => {
|
||||
assert.deepEqual(
|
||||
parseConditionExpression(
|
||||
|
||||
Reference in New Issue
Block a user