I am new to testing un RxSwift. I manage to test that an Observable emits values with RxBlocking. But I can't find the syntax to make a test pass if an Observable did not send any value.
I think I should use toBlocking(timeout: )
,but I can't find how (I have an error that it timed out, but the test fail).
Thank you for your help
Does your observable complete? It looks like you're testing to see if the observable emits any events
not values
Assuming you are testing on the XCTest Framework,
XCTAssertNil(try observable.toBlocking().first())
// Check error if necessary
XCTAssertThrowsError(try observable.toBlocking(timeout: timeout).first())