Rewrite test to take advantage of changes in assert.response/TestClient
This should avoid the issue of preventing the whole suite to halt, as in https://travis-ci.org/CartoDB/Windshaft-cartodb/builds/236337027.
This commit is contained in:
parent
248adab05b
commit
882aeacac2
@ -5,6 +5,7 @@ var step = require('step');
|
|||||||
var cartodbServer = require('../../../lib/cartodb/server');
|
var cartodbServer = require('../../../lib/cartodb/server');
|
||||||
var ServerOptions = require('./support/ported_server_options');
|
var ServerOptions = require('./support/ported_server_options');
|
||||||
var testClient = require('./support/test_client');
|
var testClient = require('./support/test_client');
|
||||||
|
var TestClient = require('../../support/test-client');
|
||||||
|
|
||||||
var BaseController = require('../../../lib/cartodb/controllers/base');
|
var BaseController = require('../../../lib/cartodb/controllers/base');
|
||||||
|
|
||||||
@ -23,6 +24,14 @@ describe('multilayer error cases', function() {
|
|||||||
BaseController.prototype.req2params = req2paramsFn;
|
BaseController.prototype.req2params = req2paramsFn;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// var client = null;
|
||||||
|
afterEach(function(done) {
|
||||||
|
if (this.client) {
|
||||||
|
return this.client.drain(done);
|
||||||
|
}
|
||||||
|
return done();
|
||||||
|
});
|
||||||
|
|
||||||
it("post layergroup with wrong Content-Type", function(done) {
|
it("post layergroup with wrong Content-Type", function(done) {
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/database/windshaft_test/layergroup',
|
url: '/database/windshaft_test/layergroup',
|
||||||
@ -153,24 +162,16 @@ describe('multilayer error cases', function() {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
ServerOptions.afterLayergroupCreateCalls = 0;
|
ServerOptions.afterLayergroupCreateCalls = 0;
|
||||||
assert.response(server, {
|
this.client = new TestClient(layergroup);
|
||||||
url: '/database/windshaft_test/layergroup',
|
this.client.getLayergroup({status: 400}, function(err, parsed) {
|
||||||
method: 'POST',
|
assert.ok(!err, err);
|
||||||
headers: {'Content-Type': 'application/json' },
|
// See http://github.com/CartoDB/Windshaft/issues/159
|
||||||
data: JSON.stringify(layergroup)
|
assert.equal(ServerOptions.afterLayergroupCreateCalls, 0);
|
||||||
}, {}, function(res) {
|
assert.ok(parsed);
|
||||||
try {
|
assert.equal(parsed.errors.length, 1);
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
var error = parsed.errors[0];
|
||||||
// See http://github.com/CartoDB/Windshaft/issues/159
|
assert.ok(error.match(/column "missing" does not exist/m), error);
|
||||||
assert.equal(ServerOptions.afterLayergroupCreateCalls, 0);
|
done();
|
||||||
var parsed = JSON.parse(res.body);
|
|
||||||
assert.ok(parsed);
|
|
||||||
assert.equal(parsed.errors.length, 1);
|
|
||||||
var error = parsed.errors[0];
|
|
||||||
assert.ok(error.match(/column "missing" does not exist/m), error);
|
|
||||||
// TODO: check which layer introduced the problem ?
|
|
||||||
done();
|
|
||||||
} catch (err) { done(err); }
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user