mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
fb044e6d88
refs #9389 - https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md Breaking changes for Ghost: - no need to create a sandbox anymore, each file get's it's own sandbox - just require sinon and use this sandbox - you can still create separate sandboxes with .createSandbox - reset single stubs: use .resetHistory instead of .reset This is a global replace for any sandbox creation. --- From https://sinonjs.org/releases/v7.2.3/sandbox/ > Default sandbox > Since sinon@5.0.0, the sinon object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one.
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
var should = require('should'),
|
|
sinon = require('sinon'),
|
|
proxyquire = require('proxyquire');
|
|
|
|
describe('parent app', function () {
|
|
let expressStub;
|
|
let use;
|
|
let apiSpy;
|
|
let parentApp;
|
|
let adminSpy;
|
|
let siteSpy;
|
|
|
|
beforeEach(function () {
|
|
use = sinon.spy();
|
|
expressStub = () => ({
|
|
use,
|
|
enable: () => {}
|
|
});
|
|
|
|
apiSpy = sinon.spy();
|
|
adminSpy = sinon.spy();
|
|
siteSpy = sinon.spy();
|
|
|
|
parentApp = proxyquire('../../../server/web/parent-app', {
|
|
express: expressStub,
|
|
'./api': apiSpy,
|
|
'./admin': adminSpy,
|
|
'./site': siteSpy
|
|
});
|
|
});
|
|
|
|
afterEach(function () {
|
|
sinon.restore();
|
|
});
|
|
|
|
it('should mount 3 apps and assign correct routes to them', function () {
|
|
parentApp();
|
|
|
|
use.calledWith('/ghost/api').should.be.true();
|
|
use.calledWith('/ghost').should.be.true();
|
|
|
|
apiSpy.called.should.be.true();
|
|
adminSpy.called.should.be.true();
|
|
siteSpy.called.should.be.true();
|
|
});
|
|
});
|