Windshaft-cartodb/test/unit/ported/windshaft-server-test.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

'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);
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();
}, /Must initialise server with/
2015-07-08 06:12:32 +08:00
);
});
});