Added regression test for turbo-cartocss' integration

This commit is contained in:
Daniel García Aubert 2016-03-09 11:48:07 +01:00
parent c6fbb08c8f
commit a0073da4b3
3 changed files with 40 additions and 33 deletions

View File

@ -36,12 +36,11 @@ TurboCartocssAdapter.prototype._parseCartoCss = function (username, layer, callb
}
this.turboCartocssParser.process(username, layer.options.cartocss, layer.options.sql, function (err, cartocss) {
if (err) {
return callback(err);
// Ignore turbo-cartocss errors and continue
if (!err && cartocss) {
layer.options.cartocss = cartocss;
}
layer.options.cartocss = cartocss;
callback(null, layer);
});
};

View File

@ -71,8 +71,8 @@ describe('tests from old api translated to multilayer', function() {
},
function(res) {
var parsed = JSON.parse(res.body);
assert.ok(parsed.errors[0]);
assert.ok(parsed.errors[0].match(/Unclosed block/));
assert.ok(parsed.errors[0].match(/^style0/));
assert.ok(parsed.errors[0].match(/missing closing/));
done();
}
);

View File

@ -31,35 +31,43 @@ function makeMapconfig(cartocss) {
};
}
describe.skip('turbo-cartocss regressions', function() {
describe('turbo-cartocss regressions', function() {
var cartocss = [
"/** simple visualization */",
"",
"Map {",
" buffer-size: 256;",
"}",
"",
"#county_points_with_population{",
" marker-fill-opacity: 0.1;",
" marker-line-color:#FFFFFF;//#CF1C90;",
" marker-line-width: 0;",
" marker-line-opacity: 0.3;",
" marker-placement: point;",
" marker-type: ellipse;",
" //marker-comp-op: overlay;",
" marker-width: [price];",
" [zoom=5]{marker-width: [price]*2;}",
" [zoom=6]{marker-width: [price]*4;}",
" marker-fill: #000000;",
" marker-allow-overlap: true;",
" ",
"",
"}"
].join('\n');
beforeEach(function () {
this.testClient = new TestClient(makeMapconfig(cartocss));
});
afterEach(function (done) {
this.testClient.drain(done);
});
it('should accept // comments', function(done) {
var cartocss = [
"/** simple visualization */",
"",
"Map {",
" buffer-size: 256;",
"}",
"",
"#county_points_with_population{",
" marker-fill-opacity: 0.1;",
" marker-line-color:#FFFFFF;//#CF1C90;",
" marker-line-width: 0;",
" marker-line-opacity: 0.3;",
" marker-placement: point;",
" marker-type: ellipse;",
" //marker-comp-op: overlay;",
" marker-width: [price];",
" [zoom=5]{marker-width: [price]*2;}",
" [zoom=6]{marker-width: [price]*4;}",
" marker-fill: #000000;",
" marker-allow-overlap: true;",
" ",
"",
"}"
].join('\n');
var testClient = new TestClient(makeMapconfig(cartocss));
testClient.createLayergroup(function(err) {
this.testClient.getTile(0, 0, 0, function(err) {
assert.ok(!err, err);
done();
});