0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/test/unit/services/apps/proxy_spec.js
Hannah Wolfe 59b9f161dd Moved non-helper code out of helpers
- the helper dir also contained some code used with helpers - utils and helper-helpers?
- the goal here was for helpers to be the only thing in their folder so we can look at moving them out
- all other code has been moved to services/themes for now, which is not the right place either
- services/themes is a catch-all for theme storage, loading, validation, rendering and more, needs to be broken down
2020-04-10 12:27:43 +01:00

36 lines
1.2 KiB
JavaScript

const should = require('should'),
sinon = require('sinon'),
helpers = require('../../../../core/frontend/services/themes/handlebars/register'),
AppProxy = require('../../../../core/frontend/services/apps/proxy'),
routing = require('../../../../core/frontend/services/routing');
describe('Apps', function () {
beforeEach(function () {
sinon.stub(routing.registry, 'getRouter').withArgs('appRouter').returns({
mountRouter: sinon.stub()
});
});
afterEach(function () {
sinon.restore();
});
describe('Proxy', function () {
it('creates a ghost proxy', function () {
var appProxy = AppProxy.getInstance('TestApp');
should.exist(appProxy.helpers);
should.exist(appProxy.helpers.register);
should.exist(appProxy.helpers.registerAsync);
});
it('allows helper registration', function () {
var registerSpy = sinon.stub(helpers, 'registerThemeHelper'),
appProxy = AppProxy.getInstance('TestApp');
appProxy.helpers.register('myTestHelper', sinon.stub().returns('test result'));
registerSpy.called.should.equal(true);
});
});
});