2020-04-29 18:44:27 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
2021-04-19 17:41:18 +03:00
|
|
|
const helpers = require('../../../../core/frontend/services/theme-engine/handlebars/register');
|
2020-04-29 18:44:27 +03:00
|
|
|
const AppProxy = require('../../../../core/frontend/services/apps/proxy');
|
|
|
|
const routing = require('../../../../core/frontend/services/routing');
|
2020-03-20 11:58:26 +03:00
|
|
|
|
|
|
|
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 () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const appProxy = AppProxy.getInstance('TestApp');
|
2020-03-20 11:58:26 +03:00
|
|
|
|
|
|
|
should.exist(appProxy.helpers);
|
|
|
|
should.exist(appProxy.helpers.register);
|
|
|
|
should.exist(appProxy.helpers.registerAsync);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('allows helper registration', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const registerSpy = sinon.stub(helpers, 'registerThemeHelper');
|
|
|
|
const appProxy = AppProxy.getInstance('TestApp');
|
2020-03-20 11:58:26 +03:00
|
|
|
|
|
|
|
appProxy.helpers.register('myTestHelper', sinon.stub().returns('test result'));
|
|
|
|
|
|
|
|
registerSpy.called.should.equal(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|