mardi 22 décembre 2020

Testing RefreshControl in Swift

Is there anyway to test RefreshControl? I have a method that calls my refreshControl and I want to be able to test it (i.e. endRefreshing was called or that the delay is equal to 5)

viewController.refreshControl?.perform(#selector(UIRefreshControl.endRefreshing), with: nil, afterDelay: 5.0)

I have tried expect(expect(sut.viewController.refreshControl?.isRefreshing).toEventually(beTrue())

with it returning false.

Edit: This is using Quick/Nimble and the refreshControl is calling a norma UIRefreshControl() on the tableView that just has a target to this method I am using

Aucun commentaire:

Enregistrer un commentaire