MakeAWishFoundation / SwiftyMocky

Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.04k stars 106 forks source link

When Using Promises, mocked layer return the result after the Verify is called. #308

Open felipeflorencio opened 2 years ago

felipeflorencio commented 2 years ago

Couldn't find anyone mentioning this.

But basically, the mocked layer is expecting a Promise.

First I use the "Given" to fill in what should be the result to that mocked layer.

Then I can the implementation.

As verification, I "Verify" if my delegate method is called.

The problem is that my "Given" mocked layer is only being resolved after my "Verify" is called, so my test always fails.

Not sure why "Given" is taking "long" to respond.

Also not sure if is possible to add "wait" to my Given so it would wait until the response come.

amichnia commented 2 years ago

Hi, can you send an example of the test? And something resembling mocked method? That would it easier for us to check for the issue.