Files
swift-composable-architectu…/Examples/TicTacToe/Tests/NewGameCoreTests.swift
Stephen Celis a429d9d3ef Merge Test Support Module (#71)
* Merge Test Support Module

An attempt to fix #70.

* Remove import

* Update README

* Assertion failure

* Cleanup

* Add NB

* Revert format change

* Update Sources/ComposableArchitecture/TestSupport/TestStore.swift

* TicTacToe fixes

* Hide test store in debug flag

Co-authored-by: Brandon Williams <mbw234@gmail.com>
2020-05-11 17:44:52 -04:00

41 lines
1.0 KiB
Swift

import ComposableArchitecture
import GameCore
import NewGameCore
import XCTest
class NewGameCoreTests: XCTestCase {
let store = TestStore(
initialState: NewGameState(),
reducer: newGameFeatureReducer,
environment: NewGameEnvironment()
)
func testFlow_NewGame_Integration() {
self.store.assert(
.send(.oPlayerNameChanged("Blob Sr.")) {
$0.oPlayerName = "Blob Sr."
},
.send(.xPlayerNameChanged("Blob Jr.")) {
$0.xPlayerName = "Blob Jr."
},
.send(.letsPlayButtonTapped) {
$0.game = GameState(oPlayerName: "Blob Sr.", xPlayerName: "Blob Jr.")
},
.send(.game(.cellTapped(row: 0, column: 0))) {
$0.game!.board[0][0] = .x
$0.game!.currentPlayer = .o
},
.send(.game(.quitButtonTapped)) {
$0.game = nil
},
.send(.letsPlayButtonTapped) {
$0.game = GameState(oPlayerName: "Blob Sr.", xPlayerName: "Blob Jr.")
},
.send(.gameDismissed) {
$0.game = nil
},
.send(.logoutButtonTapped)
)
}
}