eugef / node-mocks-http

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

Set an expiration date to a cookie when deleting it #155

Closed eugef closed 6 years ago

eugef commented 6 years ago

According to how cookie removals really work, the clearCookie() method should not delete the cookie but change its expiration date to a past one.

This is specially important when testing a function that deletes a specific cookie. Setting the cookie in the request mock doesn't propagate it to the response mock, so the cookie is really never in the response during the test. Because of that, there is no way of saying if the cookie would have been deleted by our function or not.

Here is PR that fixes it #72, but it was not merged into master. Would be nice to have this functionality avaliable

eugef commented 6 years ago

Fixed by re-merging #72 into master