Windshaft-cartodb/test/unit/cartodb/ported/windshaft_server.test.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-07-08 06:12:32 +08:00
require('../../../support/test_helper.js');
var assert = require('assert');
var cartodbServer = require('../../../../lib/cartodb/server');
var serverOptions = require('../../../../lib/cartodb/server_options');
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();
2015-07-11 01:10:55 +08:00
}, /Cannot read property 'mapnik' of undefined/
2015-07-08 06:12:32 +08:00
);
});
});