pr comment
This commit is contained in:
parent
62b94111cc
commit
4bc30a0187
|
@ -445,46 +445,40 @@ describe("Automation Scenarios", () => {
|
||||||
]
|
]
|
||||||
|
|
||||||
it.each(testCases)(
|
it.each(testCases)(
|
||||||
"should pass the filter when condition is %s",
|
"should pass the filter when condition is $condition",
|
||||||
async ({ condition, value, rowValue, expectPass }) => {
|
async ({ condition, value, rowValue, expectPass }) => {
|
||||||
it(`should ${
|
const builder = createAutomationBuilder({
|
||||||
expectPass ? "pass" : "fail"
|
name: `Test ${condition}`,
|
||||||
} the filter when condition is "${condition}" and value is ${value}`, async () => {
|
|
||||||
const builder = createAutomationBuilder({
|
|
||||||
name: `Test ${condition}`,
|
|
||||||
})
|
|
||||||
|
|
||||||
const results = await builder
|
|
||||||
.appAction({ fields: {} })
|
|
||||||
.createRow({
|
|
||||||
row: {
|
|
||||||
name: `${condition} Test`,
|
|
||||||
value: rowValue,
|
|
||||||
tableId: table._id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.queryRows({
|
|
||||||
tableId: table._id!,
|
|
||||||
})
|
|
||||||
.filter({
|
|
||||||
field: "{{ steps.2.rows.0.value }}",
|
|
||||||
condition,
|
|
||||||
value,
|
|
||||||
})
|
|
||||||
.serverLog({
|
|
||||||
text: `${condition} condition ${
|
|
||||||
expectPass ? "passed" : "failed"
|
|
||||||
}`,
|
|
||||||
})
|
|
||||||
.run()
|
|
||||||
|
|
||||||
expect(results.steps[2].outputs.result).toBe(expectPass)
|
|
||||||
if (expectPass) {
|
|
||||||
expect(results.steps[3].outputs.success).toBeTrue()
|
|
||||||
} else {
|
|
||||||
expect(results.steps[3]).toBeUndefined()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const results = await builder
|
||||||
|
.appAction({ fields: {} })
|
||||||
|
.createRow({
|
||||||
|
row: {
|
||||||
|
name: `${condition} Test`,
|
||||||
|
value: rowValue,
|
||||||
|
tableId: table._id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.queryRows({
|
||||||
|
tableId: table._id!,
|
||||||
|
})
|
||||||
|
.filter({
|
||||||
|
field: "{{ steps.2.rows.0.value }}",
|
||||||
|
condition,
|
||||||
|
value,
|
||||||
|
})
|
||||||
|
.serverLog({
|
||||||
|
text: `${condition} condition ${expectPass ? "passed" : "failed"}`,
|
||||||
|
})
|
||||||
|
.run()
|
||||||
|
|
||||||
|
expect(results.steps[2].outputs.result).toBe(expectPass)
|
||||||
|
if (expectPass) {
|
||||||
|
expect(results.steps[3].outputs.success).toBeTrue()
|
||||||
|
} else {
|
||||||
|
expect(results.steps[3]).toBeUndefined()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue