Skip to content
Snippets Groups Projects
Commit 4ad76dc3 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Update tests

parent 1d201c28
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!98Messenger example - register, confirm, and unregister user facts
......@@ -174,6 +174,41 @@ final class MyContactFeatureTests: XCTestCase {
}
}
func testLoadFactsFromClientFailure() {
struct Failure: Error {}
let failure = Failure()
let store = TestStore(
initialState: MyContactState(),
reducer: myContactReducer,
environment: .unimplemented
)
store.environment.mainQueue = .immediate
store.environment.bgQueue = .immediate
store.environment.messenger.e2e.get = {
var e2e: E2E = .unimplemented
e2e.getContact.run = {
var contact: XXClient.Contact = .unimplemented(Data())
contact.getIdFromContact.run = { _ in throw failure }
return contact
}
return e2e
}
store.send(.loadFactsTapped) {
$0.isLoadingFacts = true
}
store.receive(.didFail(failure.localizedDescription)) {
$0.alert = .error(failure.localizedDescription)
}
store.receive(.set(\.$isLoadingFacts, false)) {
$0.isLoadingFacts = false
}
}
func testErrorAlert() {
let store = TestStore(
initialState: MyContactState(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment