mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
- this is a small part of a bit of cleanup of our test files - the goal is to make the existing tests clearer with a view to making it easier to write more tests - this makes the test structure follow the codebase structure more closely - eventually we will colocate the frontend tests with the frontend code
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
const should = require('should');
|
|
const sinon = require('sinon');
|
|
const helpers = require('../../../../../core/frontend/services/helpers');
|
|
const AppProxy = require('../../../../../core/frontend/services/apps/proxy');
|
|
const 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 () {
|
|
const appProxy = AppProxy.getInstance('TestApp');
|
|
|
|
should.exist(appProxy.helperService);
|
|
should.exist(appProxy.helperService.registerAlias);
|
|
should.exist(appProxy.helperService.registerDir);
|
|
should.exist(appProxy.helperService.registerHelper);
|
|
});
|
|
|
|
it('allows helper registration', function () {
|
|
const registerSpy = sinon.stub(helpers, 'registerHelper');
|
|
const appProxy = AppProxy.getInstance('TestApp');
|
|
|
|
appProxy.helperService.registerHelper('myTestHelper', sinon.stub().returns('test result'));
|
|
|
|
registerSpy.called.should.equal(true);
|
|
});
|
|
});
|
|
});
|