Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

After / delay with verify #277

Open
Ufosek opened this issue May 9, 2019 · 4 comments
Open

After / delay with verify #277

Ufosek opened this issue May 9, 2019 · 4 comments
Labels
enhancement good first issue If you're looking to contribute, this issue is the way to go!

Comments

@Ufosek
Copy link

Ufosek commented May 9, 2019

Hello,

Is there an option in Cuckoo to use after or other delay option with matcher? Something similar to: VerificationAfterDelay

For now I combined it with expectations but I am not sure whether it's the best way.

func test() {
    let exp = expectation(description: "testShow")
    exp.expectedFulfillmentCount = 1

    delay(1.0) { // async after
        verify(view).show()
        exp.fulfill() // always fulfill
    }

    wait(for: [exp], timeout: 2.0)
}

USE CASE:
I wanted to test whether some methods were invoked in Presenter which used Timer. I could of course mock this Timer as it is usually done with API requests but for such simple scenario I think delay in verify would be better.

Regards

@MatyasKriz
Copy link
Collaborator

Hey there, at the moment Cuckoo does not support these async matchers.

It's something that I can imagine is used often, as others have already asked. However, at the moment our greatest priority is generics support.

Though you can implement this functionality if you're up for it and submit a PR. It will probably need to be a part of Cuckoo sooner or later.

@MatyasKriz MatyasKriz added enhancement help wanted This issue is asking for a way to solve a problem. labels May 10, 2019
@MatyasKriz MatyasKriz added the good first issue If you're looking to contribute, this issue is the way to go! label Feb 29, 2020
@MatyasKriz MatyasKriz removed the help wanted This issue is asking for a way to solve a problem. label May 21, 2020
@sk409
Copy link
Contributor

sk409 commented Sep 3, 2022

@MatyasKriz
I submitted a PR(#434).
This PR is a prototype, so I haven't written any comments, tests, etc.
If this PR is acceptable, I will write comments, tests and explanation to README.md.
If there are any improvements, please point them out.

@andreasziegl
Copy link

@sk409 @MatyasKriz any news on this topic? :)

@MatyasKriz
Copy link
Collaborator

Yeah, some time ago I reviewed the PR but didn't publish the comments. When I got to the PR again, I was unsure if the comments were valid, so I'll have to do another review round.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue If you're looking to contribute, this issue is the way to go!
Projects
None yet
Development

No branches or pull requests

4 participants