From d3bb0d5a43393b475ceb0c1f630696a4a426d0f7 Mon Sep 17 00:00:00 2001 From: Tyler Stromberg Date: Thu, 10 Sep 2020 14:31:09 -0700 Subject: [PATCH 1/2] Delete the deprecated test APIs/helper types --- .../Testing/WorkerTesting+Deprecated.swift | 105 ----- WorkflowReactiveSwift/Tests/WorkerTests.swift | 19 - .../DeprecatedRenderExpectations.swift | 172 ------- .../Sources/WorkflowActionTester.swift | 20 - .../WorkflowRenderTester+Deprecated.swift | 79 ---- .../WorkflowRenderTesterDeprecatedTests.swift | 433 ------------------ 6 files changed, 828 deletions(-) delete mode 100644 WorkflowReactiveSwift/Testing/WorkerTesting+Deprecated.swift delete mode 100644 WorkflowTesting/Sources/DeprecatedRenderExpectations.swift delete mode 100644 WorkflowTesting/Sources/WorkflowRenderTester+Deprecated.swift delete mode 100644 WorkflowTesting/Tests/WorkflowRenderTesterDeprecatedTests.swift diff --git a/WorkflowReactiveSwift/Testing/WorkerTesting+Deprecated.swift b/WorkflowReactiveSwift/Testing/WorkerTesting+Deprecated.swift deleted file mode 100644 index 860d53d71..000000000 --- a/WorkflowReactiveSwift/Testing/WorkerTesting+Deprecated.swift +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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( - worker: WorkerType, - output: WorkerType.Output? = nil, - file: StaticString = #file, line: UInt = #line - ) { - self.worker = worker - self.output = output - - self.expectedWorkflow = ExpectedWorkflow( - type: WorkerWorkflow.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(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? = nil, - expectedOutput: ExpectedOutput? = nil, - expectedWorkers: [ExpectedWorker] = [], - expectedWorkflows: [ExpectedWorkflow] = [], - expectedSideEffects: [ExpectedSideEffect] = [] - ) { - 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? = nil, - expectedOutput: ExpectedOutput? = nil, - expectedWorkers: [ExpectedWorker] = [], - expectedWorkflows: [ExpectedWorkflow] = [], - expectedSideEffects: [ExpectedSideEffect] = [], - assertions: (WorkflowType.Rendering) -> Void = { _ in } - ) -> RenderTester { - let expectations = RenderExpectations( - expectedState: expectedState, - expectedOutput: expectedOutput, - expectedWorkers: expectedWorkers, - expectedWorkflows: expectedWorkflows, - expectedSideEffects: expectedSideEffects - ) - - return render(file: file, line: line, with: expectations, assertions: assertions) - } - } -#endif diff --git a/WorkflowReactiveSwift/Tests/WorkerTests.swift b/WorkflowReactiveSwift/Tests/WorkerTests.swift index 5b67a2d01..e9a1464f9 100644 --- a/WorkflowReactiveSwift/Tests/WorkerTests.swift +++ b/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.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 { diff --git a/WorkflowTesting/Sources/DeprecatedRenderExpectations.swift b/WorkflowTesting/Sources/DeprecatedRenderExpectations.swift deleted file mode 100644 index 0262707a7..000000000 --- a/WorkflowTesting/Sources/DeprecatedRenderExpectations.swift +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 { - var expectedState: ExpectedState? - var expectedOutput: ExpectedOutput? - var expectedWorkflows: [ExpectedWorkflow] - var expectedSideEffects: [AnyHashable: ExpectedSideEffect] - - public init( - expectedState: ExpectedState? = nil, - expectedOutput: ExpectedOutput? = nil, - expectedWorkflows: [ExpectedWorkflow] = [], - expectedSideEffects: [ExpectedSideEffect] = [] - ) { - self.expectedState = expectedState - self.expectedOutput = expectedOutput - self.expectedWorkflows = expectedWorkflows - self.expectedSideEffects = expectedSideEffects.reduce(into: [AnyHashable: ExpectedSideEffect]()) { res, expectedSideEffect in - res[expectedSideEffect.storage.key] = expectedSideEffect - } - } - } - - @available(*, deprecated, message: "See `RenderTester` documentation for new style.") - public struct ExpectedOutput { - let output: WorkflowType.Output - let isEquivalent: (WorkflowType.Output, WorkflowType.Output) -> Bool - - public init(output: Output, isEquivalent: @escaping (Output, Output) -> Bool) where Output == WorkflowType.Output { - self.output = output - self.isEquivalent = isEquivalent - } - - public init(output: Output) where Output == WorkflowType.Output, Output: Equatable { - self.init(output: output, isEquivalent: { expected, actual in - expected == actual - }) - } - - func verify(in result: RenderTesterResult, 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 { - 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, isEquivalent: @escaping (State, State) -> Bool) where State == WorkflowType.State { - self.state = state - self.isEquivalent = isEquivalent - } - - public init(state: State) where WorkflowType.State == State, State: Equatable { - self.init(state: state, isEquivalent: { expected, actual in - expected == actual - }) - } - - func verify(in result: RenderTesterResult, 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 { - fileprivate class Storage { - let key: AnyHashable - - init(key: AnyHashable) { - self.key = key - } - - func expect(in tester: inout RenderTester, file: StaticString, line: UInt) { - tester = tester.expectSideEffect(key: key, file: file, line: line) - } - } - - private final class StorageWithAction: 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, 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(key: AnyHashable, action: ActionType) where ActionType.WorkflowType == WorkflowType { - self.storage = StorageWithAction(key: key, action: action) - } - - func expect(in tester: inout RenderTester, 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(in tester: inout RenderTester, file: StaticString, line: UInt) { - fatalError() - } - } - - private final class Storage: 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(in tester: inout RenderTester, 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(type: WorkflowType.Type, key: String = "", rendering: WorkflowType.Rendering, output: WorkflowType.Output? = nil, assertions: @escaping (WorkflowType) -> Void = { _ in }) { - self.storage = Storage(key: key, rendering: rendering, output: output, assertions: assertions) - } - - func expect(in tester: inout RenderTester, file: StaticString, line: UInt) { - storage.expect(in: &tester, file: file, line: line) - } - } - -#endif diff --git a/WorkflowTesting/Sources/WorkflowActionTester.swift b/WorkflowTesting/Sources/WorkflowActionTester.swift index 0a5cf4b88..3003b1bc6 100644 --- a/WorkflowTesting/Sources/WorkflowActionTester.swift +++ b/WorkflowTesting/Sources/WorkflowActionTester.swift @@ -161,23 +161,3 @@ extension WorkflowActionTester where WorkflowType.Output: Equatable { } } } - -extension WorkflowActionTester { - private func legacyVerifyOutputShim(_ assertions: (WorkflowType.Output?) -> Void) -> WorkflowActionTester { - 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 { - return send(action: action) - .legacyVerifyOutputShim(outputAssertions) - } - - @available(*, deprecated, renamed: "verifyState") - @discardableResult - public func assertState(_ assertions: (WorkflowType.State) -> Void) -> WorkflowActionTester { - return verifyState(assertions) - } -} diff --git a/WorkflowTesting/Sources/WorkflowRenderTester+Deprecated.swift b/WorkflowTesting/Sources/WorkflowRenderTester+Deprecated.swift deleted file mode 100644 index fe5460fbb..000000000 --- a/WorkflowTesting/Sources/WorkflowRenderTester+Deprecated.swift +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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, assertions: (WorkflowType.Rendering) -> Void) -> RenderTester { - 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? = nil, - expectedOutput: ExpectedOutput? = nil, - expectedWorkflows: [WorkflowTesting.ExpectedWorkflow] = [], - expectedSideEffects: [WorkflowTesting.ExpectedSideEffect] = [], - assertions: (WorkflowType.Rendering) -> Void - ) -> RenderTester { - 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 { - assertions(state) - return self - } - } - -#endif diff --git a/WorkflowTesting/Tests/WorkflowRenderTesterDeprecatedTests.swift b/WorkflowTesting/Tests/WorkflowRenderTesterDeprecatedTests.swift deleted file mode 100644 index 5665c440e..000000000 --- a/WorkflowTesting/Tests/WorkflowRenderTesterDeprecatedTests.swift +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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(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( - 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) -> 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) -> 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) -> 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) -> 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) -> String { - String(text.reversed()) - } -} From fa179b482936f68f9802655583bb6ce466ae85e8 Mon Sep 17 00:00:00 2001 From: Tyler Stromberg Date: Fri, 11 Sep 2020 09:08:48 -0700 Subject: [PATCH 2/2] Update migration guide --- MigrationGuide_v1.0.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/MigrationGuide_v1.0.md b/MigrationGuide_v1.0.md index a8810d690..8e2cf6042 100644 --- a/MigrationGuide_v1.0.md +++ b/MigrationGuide_v1.0.md @@ -15,6 +15,21 @@ `Workflow.rendered(with:key:)` was deprecated in Workflow v1.0α and has been removed in the beta. See details in the alpha migration guide, [below](#render-child-workflow). `RenderContext.render(workflow:key:outputMap:)` has been made `internal` instead of `public`. Child `Workflow`s should be rendered via `ChildWorkflow().rendered(in: context)` instead. +### Testing APIs + +All of the deprecated APIs covered in [Testing](#testing) below have been removed in the beta: +* `RenderTester.render(file:expectedState:expectedOutput:expectedWorkers:expectedWorkflows:expectedSideEffects:assertions:)` +* `RenderTester.render(file:line:with:assertions:)` +* `RenderTester.assert(state:)` +* `RenderExpectations` +* `ExpectedOutput` +* `ExpectedWorker` +* `ExpectedState` +* `ExpectedSideEffect` +* `ExpectedWorkflow` +* `WorkflowActionTester.send(action:outputAssertions:)` +* `WorkflowActionTester.assertState(_:)` + --- # Workflow v1.0α Migration Guide