From 4dbeb66a4cec289bae021fcba8496a4e0de70e35 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Wed, 24 Aug 2016 18:58:13 -0700 Subject: [PATCH] tests: Add render.init() to node tests. This makes sure we are explicit about partials in individual test modules. Eventually, we should figure out a way to make partials automatically compile as part of the node tests. --- frontend_tests/node_tests/templates.js | 2 ++ frontend_tests/zjsunit/index.js | 1 + frontend_tests/zjsunit/render.js | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index 654874e0b8..f489c7fe4a 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -641,6 +641,8 @@ function render(template_name, args) { }()); (function stream_sidebar_row() { + global.use_template('stream_privacy'); // partial + var args = { name: "devel", color: "red", diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js index c7dc323ad4..1e79baebe1 100644 --- a/frontend_tests/zjsunit/index.js +++ b/frontend_tests/zjsunit/index.js @@ -39,6 +39,7 @@ files.forEach(function (file) { global.patch_builtin('setInterval', noop); console.info('running tests for ' + file.name); + render.init(); require(file.full_name); namespace.restore(); }); diff --git a/frontend_tests/zjsunit/render.js b/frontend_tests/zjsunit/render.js index 8d94613fed..d9099e4935 100644 --- a/frontend_tests/zjsunit/render.js +++ b/frontend_tests/zjsunit/render.js @@ -10,6 +10,10 @@ function template_dir() { return __dirname + '/../../static/templates/'; } +exports.init = function () { + Handlebars.templates = {}; +}; + exports.make_sure_all_templates_have_been_compiled = function () { var dir = template_dir(); var fns = fs.readdirSync(dir).filter(function (fn) {