mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
ef4e4e8cc0
refs: bf0823c9a2
- continuing the work of splitting up the theme service into logical components
20 lines
739 B
JavaScript
20 lines
739 B
JavaScript
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', '<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);
|
|
});
|
|
});
|