const should = require('should'); const sinon = require('sinon'); const helpers = require('../../../core/frontend/helpers'); const proxy = require('../../../core/frontend/services/proxy'); const settingsCache = proxy.settingsCache; describe('{{ghost_foot}} helper', function () { let settingsCacheStub; afterEach(function () { sinon.restore(); }); beforeEach(function () { settingsCacheStub = sinon.stub(settingsCache, 'get'); }); it('outputs global injected code', function () { settingsCacheStub.withArgs('ghost_foot').returns(''); const rendered = helpers.ghost_foot({data: {}}); should.exist(rendered); rendered.string.should.match(/'); const rendered = helpers.ghost_foot({ data: { root: { post: { codeinjection_foot: 'post-codeinjection' } } } }); should.exist(rendered); rendered.string.should.match(/'); const rendered = helpers.ghost_foot({ data: { root: { post: { codeinjection_foot: null } } } }); should.exist(rendered); rendered.string.should.match(/'); const rendered = helpers.ghost_foot({ data: { root: { post: { codeinjection_foot: '' } } } }); should.exist(rendered); rendered.string.should.match(/