2018-06-02 22:48:23 +03:00
|
|
|
var should = require('should'),
|
2017-03-23 22:00:58 +03:00
|
|
|
_ = require('lodash'),
|
2020-03-30 18:26:47 +03:00
|
|
|
hbs = require('../../../core/frontend/services/themes/engine'),
|
2013-09-06 20:07:25 +04:00
|
|
|
|
|
|
|
// Stuff we are testing
|
2020-03-30 18:26:47 +03:00
|
|
|
helpers = require('../../../core/frontend/helpers');
|
2013-07-11 02:45:13 +04:00
|
|
|
|
2014-11-27 23:50:15 +03:00
|
|
|
describe('Helpers', function () {
|
2018-08-30 19:17:27 +03:00
|
|
|
var hbsHelpers = ['each', 'if', 'unless', 'with', 'helperMissing', 'blockHelperMissing', 'log', 'lookup', 'block', 'contentFor'],
|
2017-03-23 22:00:58 +03:00
|
|
|
ghostHelpers = [
|
2019-12-12 15:59:15 +03:00
|
|
|
'asset', 'author', 'authors', 'body_class', 'cancel_link', 'concat', 'content', 'date', 'encode', 'excerpt', 'facebook_url', 'foreach', 'get',
|
2019-07-29 20:54:15 +03:00
|
|
|
'ghost_foot', 'ghost_head', 'has', 'img_url', 'is', 'lang', 'link', 'link_class', 'meta_description', 'meta_title', 'navigation',
|
2019-09-02 14:18:27 +03:00
|
|
|
'next_post', 'page_url', 'pagination', 'plural', 'post_class', 'prev_post', 'price', 'raw', 'reading_time', 't', 'tags', 'title', 'twitter_url',
|
2017-03-23 22:00:58 +03:00
|
|
|
'url'
|
|
|
|
],
|
|
|
|
expectedHelpers = _.concat(hbsHelpers, ghostHelpers);
|
|
|
|
|
|
|
|
describe('Load Core Helpers', function () {
|
|
|
|
before(function () {
|
2018-08-30 19:17:27 +03:00
|
|
|
hbs.express4();
|
2017-03-23 22:00:58 +03:00
|
|
|
helpers.loadCoreHelpers();
|
|
|
|
});
|
2014-05-22 01:43:54 +04:00
|
|
|
|
2017-03-23 22:00:58 +03:00
|
|
|
// This will work when we finish refactoring
|
2017-04-04 19:07:35 +03:00
|
|
|
it('should have exactly the right helpers', function () {
|
2017-03-23 22:00:58 +03:00
|
|
|
var foundHelpers, missingHelpers, unexpectedHelpers;
|
2014-05-22 01:43:54 +04:00
|
|
|
|
2017-03-23 22:00:58 +03:00
|
|
|
foundHelpers = _.keys(hbs.handlebars.helpers);
|
2014-05-22 01:43:54 +04:00
|
|
|
|
2017-03-23 22:00:58 +03:00
|
|
|
missingHelpers = _.difference(expectedHelpers, foundHelpers);
|
|
|
|
unexpectedHelpers = _.difference(foundHelpers, expectedHelpers);
|
2014-05-22 01:43:54 +04:00
|
|
|
|
2017-03-23 22:00:58 +03:00
|
|
|
missingHelpers.should.be.an.Array().with.lengthOf(0);
|
|
|
|
unexpectedHelpers.should.be.an.Array().with.lengthOf(0);
|
2014-05-22 01:43:54 +04:00
|
|
|
});
|
|
|
|
});
|
2014-02-08 16:53:28 +04:00
|
|
|
});
|