DEV Community

Discussion on: Joi — awesome code validation for Node.js and Express

Collapse
 
iamdjarc profile image
IG:DjArc [Hey-R-C]

Thank you Chris for a great article, I have a question about Unit testing.... The question is how do you Test the next() or how do you test these schemas in general? thank you again.

Collapse
 
softchris profile image
Chris Noring

hi there. I usually like a mocking approach, cause we are talking middleware right? codewithhugo.com/express-request-r...

Collapse
 
iamdjarc profile image
IG:DjArc [Hey-R-C]

Hey Chris, thank you very much for that prompt reply. I am ACTUALLY please and surprised with your quickness. So I looked at the example you shared. I have to be honest I am still a novice to this testing life. So I have attached my module and test. Any pointer/guidance would be appreciated.

Here is the module

Module

Here is the test
Test Module

Thank you