You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to test using routing using the following strategy (I am using DPLRouteHandler subclasses, not block based routes). Examples are in swift (and might not compile, just giving my general strategy here)
Make route handlers classes configurable for stubbing:
I created a dummy route handler which always fails when hit
class DummyFailOneHandler: OneHandler {
public override func targetViewController() -> UIViewController! {
fatalError("I should not be called")
return nil
}
override public func viewControllerForPresentingDeepLink(deepLink: DPLDeepLink!) -> UIViewController! {
fatalError("I should not be called")
return nil
}
}
In my test, when I want to confirm that a certain route has been hit, make all other route handlers fail by stubbing them with this failed handler.
router = MyRouter(oneHandler: DummyFailOneHandler.self, twoHandler: TwoHandler.self)
let nsUrl = NSURL(string: "two")
let handled = router?.handleURL(nsUrl, withCompletion: nil)
expect(handled).to(beTrue())
This way if handleUrl returns true I know that the route has been handled by the specific route handler that is supposed to handle it (because all other route handlers automatically fail).
Sorry, code above is not tested for syntax, just a general idea.
No description provided.
The text was updated successfully, but these errors were encountered: