Skip to content

Commit

Permalink
Functional view controller testing
Browse files Browse the repository at this point in the history
  • Loading branch information
YamamotoDesu committed Mar 28, 2023
1 parent d24240b commit 5ddbcb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class StepCountController: UIViewController {
extension StepCountController {
func updateGoal(newGoal: Int) {
// update this function
AppModel.instance.dataModel.goal = newGoal
}

private func showNeedGoalAlert() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class StepCountControllerTests: XCTestCase {

override func tearDownWithError() throws {
sut = nil
AppModel.instance.dataModel.goal = nil
try super.tearDownWithError()
}

Expand Down Expand Up @@ -88,4 +89,11 @@ class StepCountControllerTests: XCTestCase {
}

// MARK: - Chase View
func testDataModel_whenGoalUpdate_updatesToNewGoal() {
// when
sut.updateGoal(newGoal: 50)

// then
XCTAssertEqual(AppModel.instance.dataModel.goal, 50)
}
}

0 comments on commit 5ddbcb4

Please sign in to comment.