mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
* 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>
41 lines
1.0 KiB
Swift
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)
|
|
)
|
|
}
|
|
}
|