Skip to content
Snippets Groups Projects
UserSearchResultFeatureTests.swift 1.16 KiB
Newer Older
import ComposableArchitecture
import XCTest
import XCTestDynamicOverlay
import XXClient
@testable import UserSearchFeature

final class UserSearchResultFeatureTests: XCTestCase {
  func testStart() {
    var contact = Contact.unimplemented("contact-data".data(using: .utf8)!)
    contact.getFactsFromContact.run = { _ in
      [
        Fact(fact: "contact-username", type: 0),
        Fact(fact: "contact-email", type: 1),
        Fact(fact: "contact-phone", type: 2),
      ]
    }

    let store = TestStore(
      initialState: UserSearchResultState(
        id: "contact-id".data(using: .utf8)!,
Dariusz Rybicki's avatar
Dariusz Rybicki committed
        xxContact: contact
      ),
      reducer: userSearchResultReducer,
      environment: .unimplemented
    )

    store.send(.start) {
      $0.username = "contact-username"
      $0.email = "contact-email"
      $0.phone = "contact-phone"
    }
  func testTapped() {
    let store = TestStore(
      initialState: UserSearchResultState(
        id: "contact-id".data(using: .utf8)!,
        xxContact: .unimplemented("contact-data".data(using: .utf8)!)
      ),
      reducer: userSearchResultReducer,
      environment: .unimplemented
    )

    store.send(.tapped)