--Originally published at That Class Blog
Sorry for uploading this week’s blog one day later. But I’ve been sick and yesterday was the worst of it. PLEASE, DON’T VACCINATE WHILE YOU HAVE THE FLU, EVEN IF THE MEDICS TELL YOU IT WONT AGGRAVATE YOUR CONDITION.
Last week we finalized the second sprint. It was a hevier sprint, for all of us. But progress and effort is getting reflected in the project. we are happy.
This last week, as I mentioned in the previous week, I mainly worked regarding two new issues. First, to create a database dummy for testing and applying hooks during testing. Second, to develop new tests applying the new features, such as hooks, for the new features (And more extensive tests for previuous done tests).
GitHub Issues:
1.- Hooks and Dummy DB
2.- Testing
Regarding the first issue:
I was reading a tutorial on Mocha/Chai testing (link below) and in a step, the guy talks about creating a different database to stop the pullution and unnecesary requests to the main DB. And that was the first part of this issue. I made a new cluster in Atlas for testing purposes, and implemented new enviroment variables and .ENV files for the connection (Which was in fact, the complicated part).
Then, I started reading in the same tutorial about hooks, and how weel those functions integrate with with database testing. The hooks available are: before(), after(), beforeEach() and afterEach(). The names basically describe everything those function do. The important thing to know is that these functions are written inside the describe() function. before() and after() esecute one time during each describe() and, if it’s an “each” function, it executes before or after each it().
Regarding the second issue:
This issue was quite simpler. Now that I uderstand hooks, I can start making more useful but simpler tests.
To summarize everything up, I made tests for the POST at /getLevel, a POST and GET at /score and the delivery of the static files.
We are almost at the middle of the available weeks! But not really…
Miguel Montoya
Esperanto enthusiast
ʕ•ᴥ•ʔ