Delete the deprecated test APIs/helper types
DELETE
WorkflowReactiveSwift/Testing/WorkerTesting+Deprecated.swift
-/*
- * Copyright 2020 Square Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if DEBUG
- import Foundation
- import WorkflowTesting
- import XCTest
- @testable import WorkflowReactiveSwift
-
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- public struct ExpectedWorker {
- let worker: Any
- let expectedWorkflow: ExpectedWorkflow
-
- private let output: Any?
-
- public init<WorkerType: Worker>(
- worker: WorkerType,
- output: WorkerType.Output? = nil,
- file: StaticString = #file, line: UInt = #line
- ) {
- self.worker = worker
- self.output = output
-
- self.expectedWorkflow = ExpectedWorkflow(
- type: WorkerWorkflow<WorkerType>.self,
- key: "",
- rendering: (),
- output: output
- ) { workflow in
- guard !workflow.worker.isEquivalent(to: worker) else {
- return
- }
- XCTFail(
- "Expected worker of type: \(WorkerType.self) not equivalent",
- file: file,
- line: line
- )
- }
- }
-
- func isEquivalent<WorkerType: Worker>(to actual: WorkerType) -> Bool {
- guard let expectedWorker = worker as? WorkerType else {
- return false
- }
-
- return expectedWorker.isEquivalent(to: actual)
- }
- }
-
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- public extension RenderExpectations {
- init(
- expectedState: ExpectedState<WorkflowType>? = nil,
- expectedOutput: ExpectedOutput<WorkflowType>? = nil,
- expectedWorkers: [ExpectedWorker] = [],
- expectedWorkflows: [ExpectedWorkflow] = [],
- expectedSideEffects: [ExpectedSideEffect<WorkflowType>] = []
- ) {
- self.init(
- expectedState: expectedState,
- expectedOutput: expectedOutput,
- expectedWorkflows: expectedWorkflows + expectedWorkers.map { $0.expectedWorkflow },
- expectedSideEffects: expectedSideEffects
- )
- }
- }
-
- public extension RenderTester {
- @discardableResult
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- func render(
- file: StaticString = #file, line: UInt = #line,
- expectedState: ExpectedState<WorkflowType>? = nil,
- expectedOutput: ExpectedOutput<WorkflowType>? = nil,
- expectedWorkers: [ExpectedWorker] = [],
- expectedWorkflows: [ExpectedWorkflow] = [],
- expectedSideEffects: [ExpectedSideEffect<WorkflowType>] = [],
- assertions: (WorkflowType.Rendering) -> Void = { _ in }
- ) -> RenderTester<WorkflowType> {
- let expectations = RenderExpectations(
- expectedState: expectedState,
- expectedOutput: expectedOutput,
- expectedWorkers: expectedWorkers,
- expectedWorkflows: expectedWorkflows,
- expectedSideEffects: expectedSideEffects
- )
-
- return render(file: file, line: line, with: expectations, assertions: assertions)
- }
- }
-#endif

MODIFY
WorkflowReactiveSwift/Tests/WorkerTests.swift
WorkflowReactiveSwift/Tests/WorkerTests.swift
@@ -55,25 +55,6 @@ class WorkerTests: XCTestCase {
disposable?.dispose()
}
- @available(*, deprecated) // Marked to silence deprecation warnings
- func testExpectedWorkerDeprecatedTests() {
- SignalProducerTestWorkflow(key: "")
- .renderTester()
- .render(
- expectedState: ExpectedState(state: 1),
- expectedWorkflows: [
- ExpectedWorkflow(
- type: WorkerWorkflow<SignalProducerTestWorker>.self,
- key: "",
- rendering: (),
- output: 1,
- assertions: { _ in }
- ),
- ],
- assertions: { _ in }
- )
- }
-
// A worker declared on a first `render` pass that is not on a subsequent should have the work cancelled.
func test_cancelsWorkers() {
struct WorkerWorkflow: Workflow {

DELETE
WorkflowTesting/Sources/DeprecatedRenderExpectations.swift
-/*
- * Copyright 2020 Square Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if DEBUG
-
- import Workflow
- import XCTest
-
- /// A set of expectations for use with the `WorkflowRenderTester`. All of the expectations must be fulfilled
- /// for a `render` test to pass.
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- public struct RenderExpectations<WorkflowType: Workflow> {
- var expectedState: ExpectedState<WorkflowType>?
- var expectedOutput: ExpectedOutput<WorkflowType>?
- var expectedWorkflows: [ExpectedWorkflow]
- var expectedSideEffects: [AnyHashable: ExpectedSideEffect<WorkflowType>]
-
- public init(
- expectedState: ExpectedState<WorkflowType>? = nil,
- expectedOutput: ExpectedOutput<WorkflowType>? = nil,
- expectedWorkflows: [ExpectedWorkflow] = [],
- expectedSideEffects: [ExpectedSideEffect<WorkflowType>] = []
- ) {
- self.expectedState = expectedState
- self.expectedOutput = expectedOutput
- self.expectedWorkflows = expectedWorkflows
- self.expectedSideEffects = expectedSideEffects.reduce(into: [AnyHashable: ExpectedSideEffect<WorkflowType>]()) { res, expectedSideEffect in
- res[expectedSideEffect.storage.key] = expectedSideEffect
- }
- }
- }
-
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- public struct ExpectedOutput<WorkflowType: Workflow> {
- let output: WorkflowType.Output
- let isEquivalent: (WorkflowType.Output, WorkflowType.Output) -> Bool
-
- public init<Output>(output: Output, isEquivalent: @escaping (Output, Output) -> Bool) where Output == WorkflowType.Output {
- self.output = output
- self.isEquivalent = isEquivalent
- }
-
- public init<Output>(output: Output) where Output == WorkflowType.Output, Output: Equatable {
- self.init(output: output, isEquivalent: { expected, actual in
- expected == actual
- })
- }
-
- func verify(in result: RenderTesterResult<WorkflowType>, file: StaticString, line: UInt) {
- result.verifyOutput(file: file, line: line) {
- XCTAssert(isEquivalent(output, $0), "Output \($0) is not equal to expected \(output)", file: file, line: line)
- }
- }
- }
-
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- public struct ExpectedState<WorkflowType: Workflow> {
- let state: WorkflowType.State
- let isEquivalent: (WorkflowType.State, WorkflowType.State) -> Bool
-
- /// Create a new expected state from a state with an equivalence block. `isEquivalent` will be
- /// called to validate that the expected state matches the actual state after a render pass.
- public init<State>(state: State, isEquivalent: @escaping (State, State) -> Bool) where State == WorkflowType.State {
- self.state = state
- self.isEquivalent = isEquivalent
- }
-
- public init<State>(state: State) where WorkflowType.State == State, State: Equatable {
- self.init(state: state, isEquivalent: { expected, actual in
- expected == actual
- })
- }
-
- func verify(in result: RenderTesterResult<WorkflowType>, file: StaticString, line: UInt) {
- result.verifyState(file: file, line: line) {
- XCTAssert(isEquivalent(state, $0), "State \($0) is not equal to expected \(state)", file: file, line: line)
- }
- }
- }
-
- public struct ExpectedSideEffect<WorkflowType: Workflow> {
- fileprivate class Storage {
- let key: AnyHashable
-
- init(key: AnyHashable) {
- self.key = key
- }
-
- func expect(in tester: inout RenderTester<WorkflowType>, file: StaticString, line: UInt) {
- tester = tester.expectSideEffect(key: key, file: file, line: line)
- }
- }
-
- private final class StorageWithAction<ActionType: WorkflowAction>: Storage where ActionType.WorkflowType == WorkflowType {
- let action: ActionType
-
- init(key: AnyHashable, action: ActionType) {
- self.action = action
- super.init(key: key)
- }
-
- override func expect(in tester: inout RenderTester<WorkflowType>, file: StaticString, line: UInt) {
- tester = tester.expectSideEffect(key: key, producingAction: action, file: file, line: line)
- }
- }
-
- fileprivate let storage: Storage
-
- public init(key: AnyHashable) {
- self.storage = Storage(key: key)
- }
-
- public init<ActionType: WorkflowAction>(key: AnyHashable, action: ActionType) where ActionType.WorkflowType == WorkflowType {
- self.storage = StorageWithAction(key: key, action: action)
- }
-
- func expect(in tester: inout RenderTester<WorkflowType>, file: StaticString, line: UInt) {
- storage.expect(in: &tester, file: file, line: line)
- }
- }
-
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- public struct ExpectedWorkflow {
- fileprivate class AnyStorage {
- func expect<ParentWorkflowType: Workflow>(in tester: inout RenderTester<ParentWorkflowType>, file: StaticString, line: UInt) {
- fatalError()
- }
- }
-
- private final class Storage<ExpectedWorkflowType: Workflow>: AnyStorage {
- let key: String
- let rendering: ExpectedWorkflowType.Rendering
- let output: ExpectedWorkflowType.Output?
- let assertions: (ExpectedWorkflowType) -> Void
-
- init(key: String, rendering: ExpectedWorkflowType.Rendering, output: ExpectedWorkflowType.Output?, assertions: @escaping (ExpectedWorkflowType) -> Void) {
- self.key = key
- self.rendering = rendering
- self.output = output
- self.assertions = assertions
- }
-
- override func expect<WorkflowType: Workflow>(in tester: inout RenderTester<WorkflowType>, file: StaticString, line: UInt) {
- tester = tester.expectWorkflow(type: ExpectedWorkflowType.self, key: key, producingRendering: rendering, producingOutput: output, file: file, line: line)
- }
- }
-
- fileprivate let storage: AnyStorage
-
- public init<WorkflowType: Workflow>(type: WorkflowType.Type, key: String = "", rendering: WorkflowType.Rendering, output: WorkflowType.Output? = nil, assertions: @escaping (WorkflowType) -> Void = { _ in }) {
- self.storage = Storage<WorkflowType>(key: key, rendering: rendering, output: output, assertions: assertions)
- }
-
- func expect<ParentWorkflowType: Workflow>(in tester: inout RenderTester<ParentWorkflowType>, file: StaticString, line: UInt) {
- storage.expect(in: &tester, file: file, line: line)
- }
- }
-
-#endif

MODIFY
WorkflowTesting/Sources/WorkflowActionTester.swift
WorkflowTesting/Sources/WorkflowActionTester.swift
@@ -161,23 +161,3 @@ extension WorkflowActionTester where WorkflowType.Output: Equatable {
}
}
}
-
-extension WorkflowActionTester {
- private func legacyVerifyOutputShim(_ assertions: (WorkflowType.Output?) -> Void) -> WorkflowActionTester<WorkflowType, Action> {
- assertions(output)
- return self
- }
-
- @available(*, deprecated, message: "use `send(action:)` followed by `verifyOutput(_:)`, `verify(output:)` or `assertNoOutput()`")
- @discardableResult
- public func send(action: Action, outputAssertions: (WorkflowType.Output?) -> Void = { _ in }) -> WorkflowActionTester<WorkflowType, Action> {
- return send(action: action)
- .legacyVerifyOutputShim(outputAssertions)
- }
-
- @available(*, deprecated, renamed: "verifyState")
- @discardableResult
- public func assertState(_ assertions: (WorkflowType.State) -> Void) -> WorkflowActionTester<WorkflowType, Action> {
- return verifyState(assertions)
- }
-}

DELETE
WorkflowTesting/Sources/WorkflowRenderTester+Deprecated.swift
-/*
- * Copyright 2020 Square Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if DEBUG
-
- import XCTest
-
- extension RenderTester {
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- @discardableResult
- public func render(file: StaticString = #file, line: UInt = #line, with expectations: RenderExpectations<WorkflowType>, assertions: (WorkflowType.Rendering) -> Void) -> RenderTester<WorkflowType> {
- var tester = self
-
- for expectedWorkflow in expectations.expectedWorkflows {
- expectedWorkflow.expect(in: &tester, file: file, line: line)
- }
-
- for (_, expectedSideEffect) in expectations.expectedSideEffects {
- expectedSideEffect.expect(in: &tester, file: file, line: line)
- }
-
- let result = tester.render(file: file, line: line, assertions: assertions)
-
- if let expectedState = expectations.expectedState {
- expectedState.verify(in: result, file: file, line: line)
- }
-
- if let expectedOutput = expectations.expectedOutput {
- expectedOutput.verify(in: result, file: file, line: line)
- }
-
- return RenderTester(
- workflow: tester.workflow,
- state: result.state
- )
- }
-
- @available(*, deprecated, message: "See `RenderTester` documentation for new style.")
- @discardableResult
- public func render(
- file: StaticString = #file, line: UInt = #line,
- expectedState: ExpectedState<WorkflowType>? = nil,
- expectedOutput: ExpectedOutput<WorkflowType>? = nil,
- expectedWorkflows: [WorkflowTesting.ExpectedWorkflow] = [],
- expectedSideEffects: [WorkflowTesting.ExpectedSideEffect<WorkflowType>] = [],
- assertions: (WorkflowType.Rendering) -> Void
- ) -> RenderTester<WorkflowType> {
- let expectations = RenderExpectations(
- expectedState: expectedState,
- expectedOutput: expectedOutput,
- expectedWorkflows: expectedWorkflows,
- expectedSideEffects: expectedSideEffects
- )
-
- return render(file: file, line: line, with: expectations, assertions: assertions)
- }
-
- @available(*, deprecated, renamed: "verifyState(_:)")
- @discardableResult
- public func assert(state assertions: (WorkflowType.State) -> Void) -> RenderTester<WorkflowType> {
- assertions(state)
- return self
- }
- }
-
-#endif

DELETE
WorkflowTesting/Tests/WorkflowRenderTesterDeprecatedTests.swift
-/*
- * Copyright 2020 Square Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Workflow
-import WorkflowTesting
-import XCTest
-
-@available(*, deprecated) // Marked to silence deprecation warnings
-final class WorkflowRenderTesterDeprecatedTests: XCTestCase {
- func test_assertState() {
- let renderTester = TestWorkflow(initialText: "initial").renderTester()
- var testedAssertion = false
-
- renderTester.assert { state in
- XCTAssertEqual("initial", state.text)
- XCTAssertEqual(.idle, state.substate)
- testedAssertion = true
- }
- XCTAssertTrue(testedAssertion)
- }
-
- func test_render() {
- let renderTester = TestWorkflow(initialText: "initial").renderTester()
- var testedAssertion = false
-
- renderTester.render(
- with: RenderExpectations(
- expectedState: ExpectedState(
- state: TestWorkflow.State(
- text: "initial",
- substate: .idle
- )
- )
- ),
- assertions: { screen in
- XCTAssertEqual("initial", screen.text)
- testedAssertion = true
- }
- )
- XCTAssertTrue(testedAssertion)
- }
-
- func test_simple_render() {
- let renderTester = TestWorkflow(initialText: "initial").renderTester()
-
- renderTester.render { screen in
- XCTAssertEqual("initial", screen.text)
- }
- }
-
- func test_action() {
- let renderTester = TestWorkflow(initialText: "initial").renderTester()
-
- renderTester.render(
- with: RenderExpectations(
- expectedState: ExpectedState(
- state: TestWorkflow.State(
- text: "initial",
- substate: .waiting
- )
- )
- ),
- assertions: { screen in
- XCTAssertEqual("initial", screen.text)
- screen.tapped()
- }
- )
- }
-
- func test_sideEffects() {
- let renderTester = SideEffectWorkflow().renderTester()
-
- renderTester.render(
- with: RenderExpectations(
- expectedState: ExpectedState(state: .success),
- expectedSideEffects: [
- ExpectedSideEffect(key: TestSideEffectKey(), action: SideEffectWorkflow.Action.testAction),
- ]
- ),
- assertions: { _ in }
- )
- }
-
- func test_output() {
- OutputWorkflow()
- .renderTester()
- .render(
- with: RenderExpectations(
- expectedOutput: ExpectedOutput(output: .success)
- ),
- assertions: { rendering in
- rendering.tapped()
- }
- )
- }
-
- func test_childWorkflow() {
- // Test the child independently from the parent.
- ChildWorkflow(text: "hello")
- .renderTester()
- .render(
- assertions: { rendering in
- XCTAssertEqual("olleh", rendering)
- }
- )
-
- // Test the parent simulating the behavior of the child. The worker would run, but because the child is simulated, does not run.
- ParentWorkflow(initialText: "hello")
- .renderTester()
- .render(
- with: RenderExpectations<ParentWorkflow>(expectedWorkflows: [
- ExpectedWorkflow(
- type: ChildWorkflow.self,
- rendering: "olleh",
- output: nil
- ),
- ]),
- assertions: { rendering in
- XCTAssertEqual("olleh", rendering)
- }
- )
- }
-
- func test_childWorkflowOutput() {
- // Test that a child emitting an output is handled as an action by the parent
- ParentWorkflow(initialText: "hello")
- .renderTester()
- .render(
- expectedState: ExpectedState(state: ParentWorkflow.State(text: "Failed")),
- expectedWorkflows: [
- ExpectedWorkflow(
- type: ChildWorkflow.self,
- rendering: "olleh",
- output: .failure
- ),
- ],
- assertions: { rendering in
- XCTAssertEqual("olleh", rendering)
- }
- )
- .assert { state in
- XCTAssertEqual("Failed", state.text)
- }
- }
-
- func test_impplict_expectations() {
- TestWorkflow(initialText: "hello")
- .renderTester()
- .render(
- expectedState: ExpectedState<TestWorkflow>(
- state: TestWorkflow.State(
- text: "hello",
- substate: .idle
- )
- ),
- expectedOutput: nil,
- expectedWorkflows: [],
- assertions: { rendering in
- XCTAssertEqual("hello", rendering.text)
- }
- )
- }
-
- func test_multiple_renders() {
- ParentWorkflow(initialText: "hello")
- .renderTester()
- .render(
- expectedState: ExpectedState(
- state: ParentWorkflow.State(text: "Failed")
- ),
- expectedWorkflows: [
- ExpectedWorkflow(
- type: ChildWorkflow.self,
- rendering: "olleh",
- output: .failure
- ),
- ],
- assertions: { rendering in
- XCTAssertEqual("olleh", rendering)
- }
- )
- .assert { state in
- XCTAssertEqual("Failed", state.text)
- }
- .render(
- expectedState: ExpectedState(
- state: ParentWorkflow.State(text: "deliaF")
- ),
- expectedWorkflows: [
- ExpectedWorkflow(
- type: ChildWorkflow.self,
- rendering: "olleh",
- output: .success
- ),
- ],
- assertions: { rendering in
- XCTAssertEqual("olleh", rendering)
- }
- )
- }
-}
-
-private struct TestWorkflow: Workflow {
- /// Input
- var initialText: String
-
- /// Output
- enum Output: Equatable {
- case first
- }
-
- struct State: Equatable {
- var text: String
- var substate: Substate
- enum Substate: Equatable {
- case idle
- case waiting
- }
- }
-
- func makeInitialState() -> State {
- State(text: initialText, substate: .idle)
- }
-
- func render(state: State, context: RenderContext<TestWorkflow>) -> TestScreen {
- let sink = context.makeSink(of: Action.self)
-
- switch state.substate {
- case .idle:
- break
- case .waiting:
- context.runSideEffect(key: "") { lifetime in
- sink.send(Action.asyncSuccess)
- }
- }
-
- return TestScreen(
- text: state.text,
- tapped: {
- sink.send(.tapped)
- }
- )
- }
-}
-
-extension TestWorkflow {
- enum Action: WorkflowAction, Equatable {
- typealias WorkflowType = TestWorkflow
-
- case tapped
- case asyncSuccess
-
- func apply(toState state: inout TestWorkflow.State) -> TestWorkflow.Output? {
- switch self {
- case .tapped:
- state.substate = .waiting
-
- case .asyncSuccess:
- state.substate = .idle
- }
- return nil
- }
- }
-}
-
-private struct OutputWorkflow: Workflow {
- enum Output {
- case success
- case failure
- }
-
- struct State {}
-
- func makeInitialState() -> OutputWorkflow.State {
- State()
- }
-
- enum Action: WorkflowAction {
- typealias WorkflowType = OutputWorkflow
-
- case emit
-
- func apply(toState state: inout OutputWorkflow.State) -> OutputWorkflow.Output? {
- switch self {
- case .emit:
- return .success
- }
- }
- }
-
- typealias Rendering = TestScreen
-
- func render(state: State, context: RenderContext<OutputWorkflow>) -> TestScreen {
- let sink = context.makeSink(of: Action.self)
-
- return TestScreen(text: "value", tapped: {
- sink.send(.emit)
- })
- }
-}
-
-private struct TestSideEffectKey: Hashable {
- let key: String = "Test Side Effect"
-}
-
-private struct SideEffectWorkflow: Workflow {
- enum State: Equatable {
- case idle
- case success
- }
-
- enum Action: WorkflowAction {
- case testAction
-
- typealias WorkflowType = SideEffectWorkflow
-
- func apply(toState state: inout SideEffectWorkflow.State) -> SideEffectWorkflow.Output? {
- switch self {
- case .testAction:
- state = .success
- }
- return nil
- }
- }
-
- typealias Rendering = TestScreen
-
- func render(state: State, context: RenderContext<SideEffectWorkflow>) -> TestScreen {
- context.runSideEffect(key: TestSideEffectKey()) { _ in }
-
- return TestScreen(text: "value", tapped: {})
- }
-
- func makeInitialState() -> State {
- .idle
- }
-}
-
-private struct TestScreen {
- var text: String
- var tapped: () -> Void
-}
-
-private struct ParentWorkflow: Workflow {
- typealias Output = Never
-
- var initialText: String
-
- struct State: Equatable {
- var text: String
- }
-
- func makeInitialState() -> ParentWorkflow.State {
- State(text: initialText)
- }
-
- enum Action: WorkflowAction {
- typealias WorkflowType = ParentWorkflow
-
- case childSuccess
- case childFailure
-
- func apply(toState state: inout ParentWorkflow.State) -> Never? {
- switch self {
- case .childSuccess:
- state.text = String(state.text.reversed())
-
- case .childFailure:
- state.text = "Failed"
- }
-
- return nil
- }
- }
-
- func render(state: ParentWorkflow.State, context: RenderContext<ParentWorkflow>) -> String {
- ChildWorkflow(text: state.text)
- .mapOutput { output -> Action in
- switch output {
- case .success:
- return .childSuccess
- case .failure:
- return .childFailure
- }
- }
- .rendered(in: context)
- }
-}
-
-private struct ChildWorkflow: Workflow {
- enum Output: Equatable {
- case success
- case failure
- }
-
- var text: String
-
- struct State {}
-
- func makeInitialState() -> ChildWorkflow.State {
- State()
- }
-
- enum Action: WorkflowAction {
- case outputSuccess
-
- typealias WorkflowType = ChildWorkflow
-
- func apply(toState state: inout ChildWorkflow.State) -> ChildWorkflow.Output? {
- switch self {
- case .outputSuccess:
- return .success
- }
- }
- }
-
- func render(state: ChildWorkflow.State, context: RenderContext<ChildWorkflow>) -> String {
- String(text.reversed())
- }
-}

Delete the deprecated test APIs/helper types