Windshaft-cartodb/test/acceptance/error-middleware-test.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

'use strict';
2017-12-02 00:52:20 +08:00
const assert = require('../support/assert');
const TestClient = require('../support/test-client');
describe('error middleware', function () {
it('should returns a errors header', function (done) {
const mapConfig = {
version: '1.6.0',
layers: [{
type: 'mapnik',
options: {}
}]
};
const errorHeader = {
mainError: {
statusCode: 400,
message: "Missing cartocss for layer 0 options",
name: "Error",
label: "ANONYMOUS LAYERGROUP",
2017-12-15 01:26:15 +08:00
type: "layer",
2017-12-02 00:52:20 +08:00
},
moreErrors: []
};
this.testClient = new TestClient(mapConfig, 1234);
2017-12-15 01:26:15 +08:00
const params = {
response: {
status: 400,
headers: {
'Content-Type': 'application/json; charset=utf-8',
'X-Tiler-Errors': JSON.stringify(errorHeader)
}
2017-12-02 00:52:20 +08:00
}
};
2017-12-15 01:26:15 +08:00
this.testClient.getLayergroup(params, (err) => {
2017-12-02 00:52:20 +08:00
assert.ifError(err);
done();
});
});
2017-12-12 23:59:07 +08:00
});