Revert "remove validation for empty conditions"
This reverts commit d37c3ab99f
.
This commit is contained in:
parent
5a9c586135
commit
9023864e65
|
@ -173,6 +173,30 @@ describe("/automations", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("Should check validation on a branch step with empty conditions", async () => {
|
||||
const automation = createAutomationBuilder({
|
||||
name: "String Equality Branching",
|
||||
appId: config.getAppId(),
|
||||
})
|
||||
.appAction({ fields: { status: "active" } })
|
||||
.branch({
|
||||
activeBranch: {
|
||||
steps: stepBuilder =>
|
||||
stepBuilder.serverLog({ text: "Active user" }),
|
||||
condition: {},
|
||||
},
|
||||
})
|
||||
.build()
|
||||
|
||||
await config.api.automation.post(automation, {
|
||||
status: 400,
|
||||
body: {
|
||||
message:
|
||||
'Invalid body - "definition.steps[0].inputs.branches[0].condition" must have at least 1 key',
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it("Should check validation on an branch that has a condition that is not valid", async () => {
|
||||
const automation = createAutomationBuilder({
|
||||
name: "String Equality Branching",
|
||||
|
|
|
@ -280,8 +280,8 @@ function generateStepSchema(allowStepTypes: string[]) {
|
|||
const branchSchema = Joi.object({
|
||||
id: Joi.string().required(),
|
||||
name: Joi.string().required(),
|
||||
condition: filterObject({ unknown: false }).required().allow(null),
|
||||
conditionUI: Joi.object().allow(null),
|
||||
condition: filterObject({ unknown: false }).required().min(1),
|
||||
conditionUI: Joi.object(),
|
||||
})
|
||||
|
||||
return Joi.object({
|
||||
|
|
Loading…
Reference in New Issue