node tests: Remove retry logic for compiling templates.

We can now use template_finder.get() to find the name we need.
This commit is contained in:
Steve Howell
2016-11-04 11:39:58 -07:00
committed by Tim Abbott
parent ee8d54db0f
commit 3d0c0e2e81

View File

@@ -11,12 +11,6 @@ function template_dir() {
return __dirname + '/../../static/templates/'; return __dirname + '/../../static/templates/';
} }
var list_of_exceptions = [""].concat((function () {
return fs.readdirSync(template_dir()).filter(function (file) {
return fs.statSync(path.join(template_dir(), file)).isDirectory();
});
}()));
exports.init = function () { exports.init = function () {
Handlebars.templates = {}; Handlebars.templates = {};
}; };
@@ -56,23 +50,8 @@ exports.compile_template = function (name) {
return; return;
} }
var flag = false, var file = exports.template_finder.get(name);
counter = 0, var data = fs.readFileSync(file.url).toString();
data;
while (flag === false && counter < list_of_exceptions.length) {
try {
data = fs.readFileSync(path.join(template_dir(), list_of_exceptions[counter], name + '.handlebars')).toString();
if (data) {
flag = true;
}
} catch (err) {
flag = false;
} finally {
counter++;
}
}
Handlebars.templates[name] = Handlebars.compile(data); Handlebars.templates[name] = Handlebars.compile(data);
}; };