Adding a test case to Meteor todo app Tutorial


I’ve done the Meteor todo app tutorial here:

Now I’d like to add another test case for the app but I’m unsure how to do this. This is probably more of a Javascript (which I am new to) testing question than a Meteor specific question but since it is related to the tutorial, I thought I’d ask here.

I’d like to test this bit of code from imports/ui/body.js:

tasks() {
// Show newest tasks at the top
return Tasks.find({}, { sort: { createdAt: -1 } });

Specifically, I’d like to write a test that verifies that the newest task is displayed first - so verify that the ‘sort’ clause is working as expected. How do I go about doing this?

Any links to relevant Javascript testing tutorials and examples are appreciated.