NodeGroup2 / autocomplete-project

An autocomplete app
https://nodetojoy-autocomplete.herokuapp.com/
MIT License
0 stars 2 forks source link

TESTS - tape - handler tests #68

Open SavageWilliam opened 7 years ago

SavageWilliam commented 7 years ago

npm test doesn't seem to work... maybe I'm running the wrong command.

Would be great to see some instructors on the tape file of how to run tests? (we are also missing this!)

The wordSearch() function is well tested, what about the handler?

marisid commented 7 years ago

In order to test the handler, we would need a mock request/response object that I think we'll learn about this week using shot or hapi? Not sure, but just because we were asked not to test endpoints, we skipped testing the handler module. @SavageWilliam which tests you cannot run exactly?

SavageWilliam commented 7 years ago

@marisid
Fair, thats exactly what we did in order to test the handlers. Check out router.test.js We just created a request object and included the end point (only required value). And actually ran out test within the mock response.

No shot or hapi needed

The tape tests - it's definitely possible Im simply running the wrong command, which is why instructions would be great :)

marisid commented 7 years ago

Cool @SavageWilliam , thanks! I thought the problem was with running tape test through istanbul to get coverage. I misunderstood. We'll update the readme with instructions on running tape tests. @msachi and @esraajb worked on testing the handlers in line with what you have done and it seemed quite involved. Sohil had commented in the gitter channel that they would show us shot to do that quicker but it's no very clear to me.