elsa-core/test/unit
Sipke Schoorstra 0a2e99ad42
Expose consumers API and recursive export option (#7309)
* Initial plan

* Add consumers API endpoint and enhance export with IncludeConsumingWorkflows option

- New endpoint: GET /workflow-definitions/{definitionId}/consumers
- Export request model: added IncludeConsumingWorkflows boolean property
- Export endpoint: recursive consumer discovery and inclusion in exports

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Address greptile-apps feedback: fix double-fetch, remove redundant HashSet, add version comment, remove unused params

- Extract WriteZipResponseAsync helper to avoid double-fetching definitions from DB
- Remove redundant existingDefinitionIds HashSet in IncludeConsumersAsync
- Add XML doc comment documenting that consumers are resolved at VersionOptions.Latest
- Remove unused constructor parameters (workflowDefinitionService, variableDefinitionMapper)

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Address greptile-apps round 2: 404 for unknown definitions, deterministic ZIP response, parallel BFS

- Consumers endpoint now returns 404 when the definition ID doesn't exist
- Single-workflow export always returns ZIP when includeConsumingWorkflows=true
- BFS traversal processes each frontier level concurrently via Task.WhenAll

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Implement workflow reference graph feature

- Added `IWorkflowReferenceGraphBuilder` interface for building complete graphs of workflow references.
- Created `WorkflowReferenceGraph` and `WorkflowReferenceEdge` models.
- Implemented `WorkflowReferenceGraphBuilder` service for recursive graph building.
- Replaced previous workflow reference query logic with the new graph-based approach in consumers.

* Refactor workflow consumers to utilize recursive graph-based approach for retrieving consumer definitions.

* Enhance workflow export by adding support for including consuming workflows and update nullable default values across endpoints and models.

* Add WorkflowReferenceGraphOptions for depth and definition limit configuration

- Introduced `WorkflowReferenceGraphOptions` to configure max depth and definition limits for reference graph building.
- Updated `WorkflowManagementFeature` to support configuring these options.
- Enhanced `WorkflowReferenceGraphBuilder` to respect configuration limits during graph construction process.

* Refactor `WorkflowReferenceGraphBuilder` to utilize target-typed new expressions for cleaner code.

* Add Workflow Reference Graph tests and scenarios

Introduced JSON files for parent-child-grandchild workflow hierarchy tests and implemented unit tests for `WorkflowReferenceGraphBuilder`. Also added component tests for workflow export and consumers endpoint validation. Updated project configuration for workflow JSON to always copy to output directory.

* Include DefinitionId in exported workflow definition filenames for uniqueness.

* Remove unused models and constants from `WorkflowReferenceGraphTests`.

* Refactor `WorkflowReferenceGraphBuilderTests`: streamline test setup with `SetupGraph`, replace repeated assertions with helper methods.

* Deterministic ZIP export and 404 test coverage for consumers endpoint (#7312)

* Initial plan

* Fix deterministic ZIP export and add 404 test for consumers endpoint

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
2026-02-20 17:40:47 +01:00
..
Elsa.Activities.UnitTests Configures Flowchart Execution via DI (#7141) 2025-12-15 10:15:39 +01:00
Elsa.Common.UnitTests Fix Multitenancy Support and Normalize Tenant ID Handling (#7217) 2026-01-30 19:54:13 +01:00
Elsa.Expressions.UnitTests Add code coverage configuration and adjust test projects (#7049) 2025-11-12 13:59:36 +01:00
Elsa.Http.UnitTests Add Elsa Script DSL (#7076) 2025-11-25 19:57:50 +01:00
Elsa.Resilience.Core.UnitTests Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
Elsa.Scheduling.UnitTests Add Elsa Script DSL (#7076) 2025-11-25 19:57:50 +01:00
Elsa.Tenants.UnitTests Fix Multitenancy Support and Normalize Tenant ID Handling (#7217) 2026-01-30 19:54:13 +01:00
Elsa.Workflows.Core.UnitTests Add integration tests for enumerables with projection to arrays (#7290) 2026-02-16 14:09:51 +01:00
Elsa.Workflows.Management.UnitTests Expose consumers API and recursive export option (#7309) 2026-02-20 17:40:47 +01:00
Elsa.Workflows.Runtime.UnitTests Add Notification Dispatch When Workflow Definitions Are Reloaded (#7293) 2026-02-16 11:14:10 +01:00
Directory.Build.props Add coverage enforcement for test projects (#6950) 2025-10-07 19:59:53 +02:00