2014-09-27 21:26:26 +04:00
|
|
|
// # Module tests
|
|
|
|
// This tests using Ghost as an npm module
|
2017-03-21 11:24:11 +03:00
|
|
|
var should = require('should'),
|
|
|
|
testUtils = require('../../utils'),
|
|
|
|
ghost = testUtils.startGhost,
|
|
|
|
i18n = require('../../../../core/server/i18n');
|
2016-09-12 14:53:04 +03:00
|
|
|
|
2015-11-12 15:29:45 +03:00
|
|
|
i18n.init();
|
2014-09-27 21:26:26 +04:00
|
|
|
|
|
|
|
describe('Module', function () {
|
2016-09-15 14:15:37 +03:00
|
|
|
before(testUtils.teardown);
|
|
|
|
|
2014-09-27 21:26:26 +04:00
|
|
|
describe('Setup', function () {
|
|
|
|
it('should resolve with a ghost-server instance', function (done) {
|
|
|
|
ghost().then(function (ghostServer) {
|
|
|
|
should.exist(ghostServer);
|
|
|
|
|
|
|
|
done();
|
2015-06-10 06:46:26 +03:00
|
|
|
}).catch(done);
|
2014-09-27 21:26:26 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should expose an express instance', function (done) {
|
|
|
|
ghost().then(function (ghostServer) {
|
|
|
|
should.exist(ghostServer);
|
|
|
|
should.exist(ghostServer.rootApp);
|
|
|
|
|
|
|
|
done();
|
2015-06-10 06:46:26 +03:00
|
|
|
}).catch(done);
|
2014-09-27 21:26:26 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should expose configuration values', function (done) {
|
|
|
|
ghost().then(function (ghostServer) {
|
|
|
|
should.exist(ghostServer);
|
|
|
|
should.exist(ghostServer.config);
|
2016-09-13 18:41:14 +03:00
|
|
|
should.exist(ghostServer.config.get('server'));
|
|
|
|
should.exist(ghostServer.config.get('paths'));
|
2014-09-27 21:26:26 +04:00
|
|
|
done();
|
2015-06-10 06:46:26 +03:00
|
|
|
}).catch(done);
|
2014-09-27 21:26:26 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have start/stop/restart functions', function (done) {
|
|
|
|
ghost().then(function (ghostServer) {
|
|
|
|
should.exist(ghostServer);
|
2016-02-08 00:27:01 +03:00
|
|
|
ghostServer.start.should.be.a.Function();
|
|
|
|
ghostServer.restart.should.be.a.Function();
|
|
|
|
ghostServer.stop.should.be.a.Function();
|
2014-09-27 21:26:26 +04:00
|
|
|
|
|
|
|
done();
|
2015-06-10 06:46:26 +03:00
|
|
|
}).catch(done);
|
2014-09-27 21:26:26 +04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|