Remove cartodb folder in unit test

This commit is contained in:
Daniel García Aubert
2019-10-07 11:29:07 +02:00
parent 73e1659378
commit 55aad4254c
26 changed files with 51 additions and 51 deletions
+19
View File
@@ -0,0 +1,19 @@
'use strict';
require('../../support/test-helper');
var assert = require('assert');
var ProfilerProxy = require('../../../lib/stats/profiler-proxy');
describe('profiler', function() {
it('Profiler is null in ProfilerProxy when profiling is not enabled', function() {
var profilerProxy = new ProfilerProxy({profile: false});
assert.equal(profilerProxy.profiler, null);
});
it('Profiler is NOT null in ProfilerProxy when profiling is enabled', function() {
var profilerProxy = new ProfilerProxy({profile: true});
assert.notEqual(profilerProxy.profiler, null);
});
});
+42
View File
@@ -0,0 +1,42 @@
'use strict';
require('../../support/test-helper');
var assert = require('assert');
var StatsClient = require('../../../lib/stats/client');
describe('stats client', function() {
var statsInstance;
before(function() {
statsInstance = StatsClient.instance;
StatsClient.instance = null;
});
after(function() {
StatsClient.instance = statsInstance;
});
it('reports errors when they repeat', function(done) {
var WADUS_ERROR = 'wadus_error';
var statsClient = StatsClient.getInstance({ host: '127.0.0.1', port: 8033 });
statsClient.socket.emit('error', 'other_error');
assert.ok(statsClient.last_error);
assert.equal(statsClient.last_error.msg, 'other_error');
assert.ok(!statsClient.last_error.interval);
statsClient.socket.emit('error', WADUS_ERROR);
assert.ok(statsClient.last_error);
assert.equal(statsClient.last_error.msg, WADUS_ERROR);
assert.ok(!statsClient.last_error.interval);
statsClient.socket.emit('error', WADUS_ERROR);
assert.ok(statsClient.last_error);
assert.equal(statsClient.last_error.msg, WADUS_ERROR);
assert.ok(statsClient.last_error.interval);
done();
});
});
+37
View File
@@ -0,0 +1,37 @@
'use strict';
require('../../support/test-helper');
var assert = require('assert');
var cartodbServer = require('../../../lib/server');
var serverOptions = require('../../../lib/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);
var server = ws.listen(global.environment.port, function() {
assert.ok(ws);
server.close(done); /* allow proper tear down */
});
});
it('throws exception if incorrect options passed in', function(){
assert.throws(
function(){
var ws = cartodbServer({unbuffered_logging:true});
ws.listen();
}, /Must initialise server with/
);
});
});