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

Handle looked up contact in ContactFeature

parent 72fdc435
No related branches found
No related tags found
2 merge requests!112Restore contacts from backup,!102Release 1.0.0
...@@ -182,6 +182,10 @@ public let contactReducer = Reducer<ContactState, ContactAction, ContactEnvironm ...@@ -182,6 +182,10 @@ public let contactReducer = Reducer<ContactState, ContactAction, ContactEnvironm
state.lookup = nil state.lookup = nil
return .none return .none
case .lookup(.didLookup(let xxContact)):
state.xxContact = xxContact
return .none
case .sendRequestTapped: case .sendRequestTapped:
if let xxContact = state.xxContact { if let xxContact = state.xxContact {
state.sendRequest = SendRequestState(contact: xxContact) state.sendRequest = SendRequestState(contact: xxContact)
......
...@@ -131,6 +131,23 @@ final class ContactFeatureTests: XCTestCase { ...@@ -131,6 +131,23 @@ final class ContactFeatureTests: XCTestCase {
} }
} }
func testLookupDidLookup() {
let contactId = "contact-id".data(using: .utf8)!
let contact = Contact.unimplemented("contact-data".data(using: .utf8)!)
let store = TestStore(
initialState: ContactState(
id: contactId,
lookup: ContactLookupState(id: contactId)
),
reducer: contactReducer,
environment: .unimplemented
)
store.send(.lookup(.didLookup(contact))) {
$0.xxContact = contact
}
}
func testSendRequestWithDBContact() { func testSendRequestWithDBContact() {
var dbContact = XXModels.Contact(id: "contact-id".data(using: .utf8)!) var dbContact = XXModels.Contact(id: "contact-id".data(using: .utf8)!)
dbContact.marshaled = "contact-data".data(using: .utf8)! dbContact.marshaled = "contact-data".data(using: .utf8)!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment