Skip to content

After / delay with verify #277

@Ufosek

Description

@Ufosek

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issueIf you're looking to contribute, this issue is the way to go!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions