jest-hbs-extension
Version:
Jest extension to test HBS templates
17 lines (12 loc) • 405 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _handlebars = require('handlebars');
var _fs = require('fs');
exports.default = (html, { templatePath, data }) => {
const template = (0, _fs.readFileSync)(templatePath).toString();
const compileHtml = (0, _handlebars.compile)(template);
const compiledHtml = compileHtml(data);
return html === compiledHtml;
};