Add some tests of importing lazy .html template modules.

This commit is contained in:
Ben Newman
2016-01-13 15:57:11 -05:00
parent 807e36a852
commit 42a6bad2e3
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<body>
{{> lazy}}
</body>
<template name="lazy">
lazy
</template>

View File

@@ -63,6 +63,28 @@ describe("app modules", () => {
});
});
describe("template modules", () => {
Meteor.isClient &&
it("should be importable on the client", () => {
assert.strictEqual(typeof Template, "function");
assert.ok(! _.has(Template, "lazy"));
require("./imports/lazy.html");
assert.ok(_.has(Template, "lazy"));
assert.ok(Template.lazy instanceof Template);
});
Meteor.isServer &&
it("should not be importable on the server", () => {
let error;
try {
require("./imports/lazy.html");
} catch (expected) {
error = expected;
}
assert.ok(error instanceof Error);
});
});
describe("native node_modules", () => {
Meteor.isServer &&
it("can be imported on the server", () => {