eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
753 stars 133 forks source link

Enable res.render() callback argument #197

Closed i-like-robots closed 4 years ago

i-like-robots commented 4 years ago

The response.render() method allows a callback to be provided as the second or third argument. Currently if this argument is used this library will not store the render data so assertions cannot be made on it.

This PR refactors the mock render() method to allow a callback to be provided as the second or third argument and if present will call it rather than ending the response. It is intended to closely follow the logic implemented by Express.

eugef commented 4 years ago

@i-like-robots thanks for your PR