2018-10-24 00:39:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2019-10-07 17:29:07 +08:00
|
|
|
require('../../support/test-helper');
|
2015-07-08 06:12:32 +08:00
|
|
|
|
|
|
|
var assert = require('assert');
|
2019-10-07 17:29:07 +08:00
|
|
|
var cartodbServer = require('../../../lib/server');
|
|
|
|
var serverOptions = require('../../../lib/server-options');
|
2015-07-08 06:12:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
describe('windshaft', function() {
|
|
|
|
|
|
|
|
it('should have valid global environment', function() {
|
|
|
|
assert.equal(global.environment.name, 'test');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can instantiate a Windshaft object (configured express instance)', function(){
|
|
|
|
var ws = cartodbServer(serverOptions);
|
|
|
|
assert.ok(ws);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can spawn a new server on the global listen port', function(done){
|
|
|
|
var ws = cartodbServer(serverOptions);
|
2016-12-19 23:19:41 +08:00
|
|
|
var server = ws.listen(global.environment.port, function() {
|
2015-07-08 06:12:32 +08:00
|
|
|
assert.ok(ws);
|
2015-09-17 06:19:00 +08:00
|
|
|
server.close(done); /* allow proper tear down */
|
2015-07-08 06:12:32 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('throws exception if incorrect options passed in', function(){
|
|
|
|
assert.throws(
|
|
|
|
function(){
|
|
|
|
var ws = cartodbServer({unbuffered_logging:true});
|
|
|
|
ws.listen();
|
2018-04-03 01:02:31 +08:00
|
|
|
}, /Must initialise server with/
|
2015-07-08 06:12:32 +08:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|