User blog:Taldin/Travis, Mocha, and Making Tests...?

In the process of trying to send a pull request, one of the devs said it can't go through without a test for it. And, well, for a long time there's been that note on the Contributing to Habitica page that says they need tests written. Rather than say 'I can't do that', perhaps it would be better if I learned how.

It's daunting. It's learning something blind, stumbling around in the darkness of the unknown with only a dim light of understanding what's involved, but with a will to learn.

This is why I'm good at my job as a technical writer; I'm not afraid to chase down leads for information and learn by example and by doing.

I'm writing down my findings and thoughts as I go, in the hopes of maybe making a better page for this later on.

Onward! This is going to be a longer project than just a few hours, and I have other things to do today. But it's the first step on a longer journey for sure.
 * TravisCI seemed to be the testing thing of choice.  So I made myself a Github copy of the Travis broken example. Simple enough; it's one file for the test, and one for the configuration file.
 * Reading the Travis instructions pointed me at the .travis.yml file, which contains dependencies and build tests. But that in turn led me to figure out that what the test harness really is is something called Mocha, which is called by Travis...
 * Mocha looks a bit more involved, but here's where some of those tests start looking familiar.  I'm guessing that I need to:
 * Create a mocha test file in a sandbox.
 * Write a test.    This is the hardest part, because I have to figure out something to test, and then translate the lesson over to Habitica's tests.   I've already found the test directory, and it's pretty scary-looking in the sense of how many things are being tested.
 * Figure out what I need to do to test (though it looks like only pushing to the database is needed).