I am writing a complex route that it's made more manageable by splitting it in pre handlers. One to gather data from the db, one to validate the data, one to post the data to an external service, and so on.
It would be awesome if I could stub each pre separately in test, so I could test what happens to the route lifecycle as a whole if for example the data is not valid, etc. I have fiddled around an hour or two but there seems no way to do so. Any idea?
I am writing a complex route that it's made more manageable by splitting it in
pre
handlers. One to gather data from the db, one to validate the data, one to post the data to an external service, and so on.It would be awesome if I could stub each
pre
separately in test, so I could test what happens to the route lifecycle as a whole if for example the data is not valid, etc. I have fiddled around an hour or two but there seems no way to do so. Any idea?