0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/test/unit/frontend/services/theme-engine/handlebars/template.test.js
Hannah Wolfe c902d91c81
Renamed rendering service to handlebars
- This fits more closely, as this service is to so with rendering helpers and small parts
- Whereas we want to use "rendering" for things concerned with rendering pages
2022-04-05 20:10:33 +01:00

20 lines
740 B
JavaScript

const should = require('should');
const errors = require('@tryghost/errors');
const {hbs, templates} = require('../../../../../../core/frontend/services/handlebars');
describe('Helpers Template', function () {
it('can execute a template', function () {
hbs.registerPartial('test', '<h1>Hello {{name}}</h1>');
const safeString = 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(() => {
templates.execute('non-existent');
}, errors.IncorrectUsageError);
});
});