Test helpers for validating workflow definitions.
Checks DAG validity, step input functions, failure policy coverage, and structural correctness for both compiled and dynamic workflows.
Usage
defmodule MyApp.Workflows.VendorOnboardingTest do
use ExUnit.Case, async: true
use Cyclium.Test.WorkflowCase
test "workflow is valid" do
assert_valid_workflow(MyApp.Workflows.VendorOnboarding)
end
test "step inputs don't crash" do
assert_step_inputs_safe(MyApp.Workflows.VendorOnboarding,
trigger: %{"vendor_id" => "v123"}
)
end
end
Summary
Functions
Assert that every step has a failure policy defined. Useful for enforcing that teams explicitly handle failures for all steps.
Assert that all failure policies reference existing steps and use valid policy types.
Assert that all step input functions execute without crashing for the given trigger payload. Uses empty prior results for root steps and mock prior results for dependent steps.
Assert that a workflow module has a valid definition: trigger set, steps form a DAG, no duplicate IDs, all depends_on references exist.
Functions
Assert that every step has a failure policy defined. Useful for enforcing that teams explicitly handle failures for all steps.
Assert that all failure policies reference existing steps and use valid policy types.
Assert that all step input functions execute without crashing for the given trigger payload. Uses empty prior results for root steps and mock prior results for dependent steps.
Options
:trigger— trigger payload map (required):prior— mock prior step results (default: auto-generated empty maps)
Assert that a workflow module has a valid definition: trigger set, steps form a DAG, no duplicate IDs, all depends_on references exist.