generated from dankinsoid/iOSLibraryTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aeb92d3
commit b7bc4f4
Showing
2 changed files
with
205 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,27 +9,24 @@ import XCTest | |
final class AppCoreTests: XCTestCase { | ||
@MainActor | ||
func testIntegration() async { | ||
let store = TestStore(TicTacToe()) { | ||
TicTacToe.body | ||
} withDependencies: { | ||
let middleware = TestMiddleware() | ||
let store = Store(TicTacToe.login()).transformDI { | ||
$0.authenticationClient.login = { @Sendable _, _ in | ||
AuthenticationResponse(token: "deadbeef", twoFactorRequired: false) | ||
} | ||
} | ||
.middleware(middleware) | ||
|
||
await store.send(\.login.view.binding.email, "[email protected]") { | ||
$0.login?.email = "[email protected]" | ||
} | ||
await store.send(\.login.view.binding.password, "bl0bbl0b") { | ||
$0.login?.password = "bl0bbl0b" | ||
$0.login?.isFormValid = true | ||
} | ||
await store.send(\.login.view.loginButtonTapped) { | ||
$0.login?.isLoginRequestInFlight = true | ||
} | ||
await store.receive(\.login.loginResponse.success) { | ||
$0 = .newGame(NewGame.State()) | ||
} | ||
store.state.login.email = "[email protected]" | ||
XCTAssertEqual(store.state.login.email, "[email protected]") | ||
store.state.login.password = "bl0bbl0b" | ||
XCTAssertEqual(store.state.login.password, "bl0bbl0b") | ||
XCTAssertTrue(store.state.login.isFormValid) | ||
|
||
await store.login.loginButtonTapped() | ||
// XCTAssertTrue(store.login.isLoginRequestInFlight) | ||
XCTAssertEqual(store.state.selected, .newGame) | ||
store.state.newGame.oPlayerName = "Blob Sr." | ||
await store.send(\.newGame.binding.oPlayerName, "Blob Sr.") { | ||
$0.newGame?.oPlayerName = "Blob Sr." | ||
} | ||
|
Oops, something went wrong.