mock-express-request-response icon indicating copy to clipboard operation
mock-express-request-response copied to clipboard

Error in Express testing guide referencing this example

Open meatnordrink opened this issue 2 years ago • 0 comments

Hi Hugo!

I thought your Express testing guide was great, but noticed a typo - right at the beginning on, you have:

const mockResponse = {
  const res = {};
  // replace the following () => res
  // with your function stub/mock of choice
  // making sure they still return `res`
  res.status = () => res;
  res.json = () => res;
  return res;
};

This should, of course, be a function - as it is in your example.

Thanks again for the great guide! Very clear.

meatnordrink avatar Oct 14 '22 21:10 meatnordrink