RSCodingClub / STUCO-Backend

MIT License
3 stars 0 forks source link

Add more unit testing (Test local features not successful requests). #55

Open itotallyrock opened 7 years ago

itotallyrock commented 7 years ago

There is almost no unit testing. Which is a very valuable utility to our disposal. Rather than wait on @week3 to make sure we didn't mess anything up on his end we should just make sure for ourselves. Before we got stuck at whether on not to test the webserver's responses or individual functions of the app. And honestly it is still a good question, but testing individual functions allows for more fine tuned error catching as well as less effort on configuring mocha to work with testing a REST api.

itotallyrock commented 7 years ago

I found an interesting library that is useful for testing REST APIs, supertest. It is compatible with mocha so it can be combined with unit testing as well. It offers a number of ways to verify server responses, combined with unit testing could offer a great way to spot all the bug.

However it isn't a priority like unit testing and is something to do after the fact.

itotallyrock commented 7 years ago

We're going to keep unit or spec tests separate from REST API tests. We will simple run Mocha tests for individual functions. For example we would test out the each of the user methods static and instance methods. There is potential to add time as a requirement for all unit tests as well, to reduce the chance of any timing based bugs getting passed into the active build.