How do I do a unit test for a template helper, which returns a cursor?
As a very simple example, this helper gives me all articles
Template.example.helpers({
articles() {
return Articles.find( { title: { $exists: true } } );
}
});
Now I start to write the test:
describe("template helpers", function () {
it("article should return a cursor to the template", function () {
var articles = Template.example.__helpers.get('articles');
expect(articles).to.not.be.undefined;
});
});
So this is working, but it is quite a bad test.