[removedAfterProceeding] Immediately completes if there's no first loadedInstance - MOB
MODIFY
Sources/Workflow/Models/Workflow.swift
Sources/Workflow/Models/Workflow.swift
@@ -123,8 +123,7 @@ public final class Workflow<F: FlowRepresentable>: LinkedList<_WorkflowItem> {
}
guard let first = firstLoadedInstance else {
- #warning("This should be changed to orchestrationResponder.complete")
- onFinish?(passedArgs)
+ orchestrationResponder.complete(AnyWorkflow(self), passedArgs: passedArgs, onFinish: onFinish)
return nil
}

MODIFY
Tests/WorkflowTests/OrchestrationResponder/SkipThroughWorkflowTests.swift
Tests/WorkflowTests/OrchestrationResponder/SkipThroughWorkflowTests.swift
@@ -374,6 +374,7 @@ class SkipThroughWorkflowTests: XCTestCase {
.thenProceed(with: FR2.self)
.thenProceed(with: FR3.self)
let responder = MockOrchestrationResponder()
+ responder.complete_EnableDefaultImplementation = true
let launchedRepresentable = wf.launch(withOrchestrationResponder: responder, args: FR1.id) { id in
expectation.fulfill()
@@ -384,6 +385,7 @@ class SkipThroughWorkflowTests: XCTestCase {
XCTAssertNil(launchedRepresentable)
XCTAssertNil(responder.lastTo)
XCTAssertNil(responder.lastFrom)
+ XCTAssertEqual(responder.completeCalled, 1)
wait(for: [FR2.expectation, FR3.expectation, expectation], timeout: 3)
}

MODIFY
Tests/WorkflowTests/WorkflowConsumerTests.swift
Tests/WorkflowTests/WorkflowConsumerTests.swift
@@ -153,7 +153,9 @@ class WorkflowConsumerTests: XCTestCase {
let wf: Workflow = Workflow(FR1.self)
var callbackCalled = false
- _ = wf.launch(withOrchestrationResponder: MockOrchestrationResponder(), args: 1) { args in
+ let responder = MockOrchestrationResponder()
+ responder.complete_EnableDefaultImplementation = true
+ wf.launch(withOrchestrationResponder: responder, args: 1) { args in
callbackCalled = true
XCTAssertEqual(args.extractArgs(defaultValue: nil) as? String, "args")
}

[removedAfterProceeding] Immediately completes if there's no first loadedInstance - MOB