Im new to Chai. What I understand, in order to make the tests work, the routes should always return http code 200. Is that correct? As soon as I have a route returning other then 200 I get errors in test suite (for example Uncaught Error: Internal Server Error).
In my routes, when passed data is wrong (for example validation) I would like to return other codes than 200. I think I read somewhere that it can be good practice to return other codes than 200 for resources that are not returning OK (for example vaidation errors or database errors). But again it seems that I have to return 200 for making Chai tests work. Am I missing something or it really needs to be 200 all the time?
via oderfla
No comments:
Post a Comment