In my /imports/ui/admin/category
folder, there are these files:
category.jade
category.js
category.test.js
As I want to do a test for the template helpers, I do get an error message
Error: Cannot find module './category.jade'
I don’t understand why, as this file exists and the app is working in non-test-mode. What am I doing wrong?
/imports/ui/admin/category/category.js
import { Categories } from '../../../api/collections.js';
import './category.jade';
Template.categories.helpers({
categories() {
return Categories.find( { type: { $exists: false } } );
}
});
Now I want to do a test for this helper:
/imports/ui/admin/category/category.test.js
import { chai, expect } from 'meteor/practicalmeteor:chai';
import './category.js';
describe("Category helper", function () {
it("Should return a cursor to the template", function () {
var categories = Template.categories.__helpers.get('categories');
expect(categories).to.not.be.undefined;
});
});
/imports/ui/ui.js
import './admin/category/category.js';
Which is loaded by…
/client/main.js
import '/imports/ui/ui.js';