How to use wasNeverCalled() within eventually { } blocks for async scenarios
sirghi opened this issue · comments
Maybe I'm missing something, but while eventually
blocks work well with wasCalled()
verifications, they seem to fail with wasNeverCalled()
ones.
Basically I have an async call, and I need to verify that a certain method wasn't called during the wait. If I put wasNeverCalled()
inside the eventually
block, the test fails with the customary Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "Async verification group".
Unfortunately asynchronous verification blocks don’t support wasNeverCalled()
, but since it’s backed by an XCTestExpectation
, you can set the isInverted
property to true
and it should do what you’re looking for.
Oh, thanks for the hint! Learning something new everyday.