Skip to content

Commit

Permalink
Merge pull request #101 from 72A12F4E/main
Browse files Browse the repository at this point in the history
Tutorial Formatting Fixes
  • Loading branch information
dhavalshreyas authored Sep 23, 2021
2 parents 096c676 + 8d7c483 commit af191b3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
6 changes: 6 additions & 0 deletions Samples/Tutorial/Tutorial4.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,9 @@ Is the code better after this refactor? It's debatable - having the logic in the
Additionally, now the `TodoList` and `TodoEdit` workflows are completely decoupled - there is no longer a requirement that the `TodoEdit` workflow is displayed after the list. For instance, we could change the list to have "viewing" or "editing" modes, where tapping on an item might only allow it to be viewed, but another mode would allow editing.

It comes down to the individual judgement of the developer to decide how a tree of workflows should be shaped - this was intended to provide two examples of how this _could_ be structured, but not specify how it _should_.

## Up Next

We now have a pretty fully formed app. However, if we want to keep adding features, we'll want to validate that existing features don't break while we're making improvements. In the next tutorial, we'll cover a couple of techniques for testing workflows.

[Tutorial 5](Tutorial5.md)
36 changes: 18 additions & 18 deletions Samples/Tutorial/Tutorial5.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,24 +578,24 @@ class TodoWorkflowTests: XCTestCase {
step: .list
))
// We only expect the TodoListWorkflow to be rendered.
.expectWorkflow(
type: TodoListWorkflow.self,
producingRendering: BackStackScreen<AnyScreen>.Item(
screen: TodoListScreen(todoTitles: ["Title"], onTodoSelected: { _ in }).asAnyScreen()
),
// Simulate selecting the first todo.
producingOutput: .selectTodo(index: 0)
)
.render { items in
// Just validate that there is one item in the back stack.
// Additional validation could be done on the screens returned, if desired.
XCTAssertEqual(1, items.count)
}
// Assert that the state was updated after the render pass with the output from the TodoListWorkflow.
.assert(state: TodoWorkflow.State(
todos: [TodoModel(title: "Title", note: "Note")],
step: .edit(index: 0)
))
.expectWorkflow(
type: TodoListWorkflow.self,
producingRendering: BackStackScreen<AnyScreen>.Item(
screen: TodoListScreen(todoTitles: ["Title"], onTodoSelected: { _ in }).asAnyScreen()
),
// Simulate selecting the first todo.
producingOutput: .selectTodo(index: 0)
)
.render { items in
// Just validate that there is one item in the back stack.
// Additional validation could be done on the screens returned, if desired.
XCTAssertEqual(1, items.count)
}
// Assert that the state was updated after the render pass with the output from the TodoListWorkflow.
.assert(state: TodoWorkflow.State(
todos: [TodoModel(title: "Title", note: "Note")],
step: .edit(index: 0)
))
}

func testSavingTodo() throws {
Expand Down

0 comments on commit af191b3

Please sign in to comment.