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