test(workflow-engine-redist): Update tests to ensure behaviour validation properly (#12514)
This commit is contained in:
committed by
GitHub
parent
aaf5407d29
commit
399dddc0c7
@@ -29,6 +29,12 @@ createWorkflow(
|
||||
}
|
||||
)
|
||||
|
||||
const step_1_async = createStep(
|
||||
"step_1_async",
|
||||
jest.fn(async (input) => {}),
|
||||
jest.fn()
|
||||
)
|
||||
|
||||
createWorkflow(
|
||||
{
|
||||
name: "workflow_transaction_timeout_async",
|
||||
@@ -37,7 +43,7 @@ createWorkflow(
|
||||
retentionTime: 5,
|
||||
},
|
||||
function (input) {
|
||||
const resp = step_1(input).config({
|
||||
const resp = step_1_async(input).config({
|
||||
async: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -654,7 +654,7 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
||||
"workflow_transaction_timeout",
|
||||
{
|
||||
input: {},
|
||||
transactionId: "trx",
|
||||
transactionId: "trx" + ulid(),
|
||||
throwOnError: false,
|
||||
}
|
||||
)) as Awaited<{
|
||||
@@ -663,6 +663,8 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
||||
errors: any
|
||||
}>
|
||||
|
||||
await setTimeout(500)
|
||||
|
||||
expect(transaction.getFlow().state).toEqual("reverted")
|
||||
expect(result).toEqual({ executed: true })
|
||||
expect(errors).toHaveLength(1)
|
||||
@@ -710,9 +712,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
||||
})
|
||||
|
||||
it("should revert the entire transaction when the transaction timeout expires in a transaction containing an async step", async () => {
|
||||
const transactionId = "transaction_1" + ulid()
|
||||
await workflowOrcModule.run("workflow_transaction_timeout_async", {
|
||||
input: {},
|
||||
transactionId: "transaction_1",
|
||||
transactionId,
|
||||
throwOnError: false,
|
||||
})
|
||||
|
||||
@@ -722,7 +725,7 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
||||
"workflow_transaction_timeout_async",
|
||||
{
|
||||
input: {},
|
||||
transactionId: "transaction_1",
|
||||
transactionId,
|
||||
throwOnError: false,
|
||||
}
|
||||
)) as Awaited<{
|
||||
@@ -734,7 +737,7 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
||||
expect(transaction.getFlow().state).toEqual("reverted")
|
||||
expect(result).toEqual(undefined)
|
||||
expect(errors).toHaveLength(1)
|
||||
expect(errors[0].action).toEqual("step_1")
|
||||
expect(errors[0].action).toEqual("step_1_async")
|
||||
expect(
|
||||
TransactionTimeoutError.isTransactionTimeoutError(errors[0].error)
|
||||
).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user