Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Binary operator '==' cannot be applied to two '[Recorded<Event<Void>>]' operands #1552

Closed
Arcovv opened this issue Jan 22, 2018 · 1 comment

Comments

@Arcovv
Copy link
Contributor

Arcovv commented Jan 22, 2018

Short description of the issue:

Binary operator '==' cannot be applied to two '[Recorded<Event>]' operands. Void isn't implement Equatable.

What actually happens:

Hi,

Recently I tried to use RxTest with ViewModel architecture in my project. But I got some wrong from Xcode, that "Binary operator '==' cannot be applied to two '[Recorded<Event>]' operands" error log.

There is my MVVM code:

protocol ProfileViewModelInputs {
  func didTapSettingButton()
}

protocol ProfileViewModelOutputs {
  var showSetting: Signal<Void> { get }
}

final class ProfileViewModel {

  let showSetting: Signal<Void>

  init() {
    showSetting = tappingSettingButtonSubject.asSignal()
  }

  fileprivate let tappingSettingButtonSubject = PublishRelay<Void>()
  func didTapSettingButton() {
    tappingSettingButtonSubject.accept(())
  }
}

And my test code:

class ProfileViewModelTests: XCTestCase {
  
  private var viewModel: ProfileViewModel!
  private var disposeBag: DisposeBag!
  private var schedule: TestScheduler!
  
  override func setUp() {
    super.setUp()
    viewModel = ProfileViewModel()
    disposeBag = DisposeBag()
    schedule = TestScheduler(initialClock: 0)
  }
  
  override func tearDown() {
    super.tearDown()
    viewModel = nil
    disposeBag = nil
    schedule = nil
  }
  
  func test_tapping_setting_button() {
    let tapObserver = schedule.createObserver(Void.self)
    viewModel.outputs.showSetting
      .debug(#function)
      .emit(to: tapObserver)
      .disposed(by: disposeBag)
    schedule.start()
    
    viewModel.inputs.didTapSettingButton()
    
    let expectedEvents = [
      next(0, ())
    ]
    let tapEvents = tapObserver.events

    XCTAssert("\(tapObserver.events)" == "\(expectedEvents)")
  }
}

In this code, I can't use tapObserver.events == expectedEvents because Void is not implemented Equatable. Only I can transform it to string. How to solve this problem?

Thanks for you help.

@kzaher
Copy link
Member

kzaher commented Jan 22, 2018

Hi,

this doesn't look like an issue with the project itself but more of a "how do I do XXX" question.
Please ask these kinds of questions in our slack channel http://rxswift-slack.herokuapp.com/ or some other more appropriate communication channel.

We are asking this because:

  • we can't scale development of this project if people are reporting false issues and we are spending lot of time answering those directly instead of working on this project.
  • all who are interested in development of this project and watching it are being spammed by irrelevant information.
  • those who want to know what are currently unresolved serious issues are having a harder time figuring it out because list is spammed by non issues, so the real issues are masked.

Thank you for understanding.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants