remove validation for empty conditions
This commit is contained in:
parent
dd9057169f
commit
d37c3ab99f
|
@ -173,30 +173,6 @@ 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 () => {
|
it("Should check validation on an branch that has a condition that is not valid", async () => {
|
||||||
const automation = createAutomationBuilder({
|
const automation = createAutomationBuilder({
|
||||||
name: "String Equality Branching",
|
name: "String Equality Branching",
|
||||||
|
|
|
@ -280,8 +280,8 @@ function generateStepSchema(allowStepTypes: string[]) {
|
||||||
const branchSchema = Joi.object({
|
const branchSchema = Joi.object({
|
||||||
id: Joi.string().required(),
|
id: Joi.string().required(),
|
||||||
name: Joi.string().required(),
|
name: Joi.string().required(),
|
||||||
condition: filterObject({ unknown: false }).required().min(1),
|
condition: filterObject({ unknown: false }).required().allow(null),
|
||||||
conditionUI: Joi.object(),
|
conditionUI: Joi.object().allow(null),
|
||||||
})
|
})
|
||||||
|
|
||||||
return Joi.object({
|
return Joi.object({
|
||||||
|
|
Loading…
Reference in New Issue