chore(workflow-engine): export cancel method (#11844)
What: * Workflow engine exports the method `cancel` to revert a workflow.
This commit is contained in:
committed by
GitHub
parent
3db146c56e
commit
0625f76cd4
@@ -512,6 +512,26 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
||||
|
||||
failTrap(done)
|
||||
})
|
||||
|
||||
it("should cancel and revert a completed workflow", async () => {
|
||||
const workflowId = "workflow_sync"
|
||||
|
||||
const { acknowledgement, transaction: trx } =
|
||||
await workflowOrcModule.run(workflowId, {
|
||||
input: {
|
||||
value: "123",
|
||||
},
|
||||
})
|
||||
|
||||
expect(trx.getFlow().state).toEqual("done")
|
||||
expect(acknowledgement.hasFinished).toBe(true)
|
||||
|
||||
const { transaction } = await workflowOrcModule.cancel(workflowId, {
|
||||
transactionId: acknowledgement.transactionId,
|
||||
})
|
||||
|
||||
expect(transaction.getFlow().state).toEqual("reverted")
|
||||
})
|
||||
})
|
||||
|
||||
// Note: These tests depend on actual Redis instance and waiting for the scheduled jobs to run, which isn't great.
|
||||
|
||||
Reference in New Issue
Block a user