0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/test/unit/services/theme-engine/handlebars/template_spec.js

21 lines
739 B
JavaScript
Raw Normal View History

const should = require('should');
const errors = require('@tryghost/errors');
const proxy = require('../../../../../core/frontend/services/proxy');
describe('Helpers Template', function () {
2014-06-04 22:26:03 +01:00
it('can execute a template', function () {
proxy.hbs.registerPartial('test', '<h1>Hello {{name}}</h1>');
const safeString = proxy.templates.execute('test', {name: 'world'});
should.exist(safeString);
safeString.should.have.property('string').and.equal('<h1>Hello world</h1>');
});
it('will throw an IncorrectUsageError if the partial does not exist', function () {
should.throws(() => {
proxy.templates.execute('non-existent');
}, errors.IncorrectUsageError);
});
});