2018-10-24 00:39:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2015-09-26 01:21:20 +08:00
|
|
|
require('../../support/test_helper');
|
2015-07-08 05:46:58 +08:00
|
|
|
|
|
|
|
var assert = require('../../support/assert');
|
|
|
|
var step = require('step');
|
|
|
|
var cartodbServer = require('../../../lib/cartodb/server');
|
|
|
|
var ServerOptions = require('./support/ported_server_options');
|
|
|
|
var testClient = require('./support/test_client');
|
2017-05-26 19:13:19 +08:00
|
|
|
var TestClient = require('../../support/test-client');
|
2015-07-08 05:46:58 +08:00
|
|
|
|
2018-03-17 01:18:06 +08:00
|
|
|
describe('multilayer error cases', function() {
|
2018-04-16 22:16:23 +08:00
|
|
|
var server;
|
2015-07-08 05:46:58 +08:00
|
|
|
|
2018-04-16 22:16:23 +08:00
|
|
|
before(function () {
|
|
|
|
server = cartodbServer(ServerOptions);
|
|
|
|
server.setMaxListeners(0);
|
|
|
|
});
|
2015-07-08 05:46:58 +08:00
|
|
|
|
2017-05-26 19:13:19 +08:00
|
|
|
// var client = null;
|
|
|
|
afterEach(function(done) {
|
|
|
|
if (this.client) {
|
|
|
|
return this.client.drain(done);
|
|
|
|
}
|
|
|
|
return done();
|
|
|
|
});
|
|
|
|
|
2015-07-08 05:46:58 +08:00
|
|
|
it("post layergroup with wrong Content-Type", function(done) {
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
}
|
2015-07-08 05:46:58 +08:00
|
|
|
}, {}, function(res) {
|
|
|
|
assert.equal(res.statusCode, 400, res.body);
|
|
|
|
var parsedBody = JSON.parse(res.body);
|
2017-11-06 01:55:23 +08:00
|
|
|
assert.deepEqual(parsedBody.errors, ["POST data must be of type application/json"]);
|
2015-07-08 05:46:58 +08:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("post layergroup with no layers", function(done) {
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
2015-07-08 05:46:58 +08:00
|
|
|
}, {}, function(res) {
|
|
|
|
assert.equal(res.statusCode, 400, res.body);
|
|
|
|
var parsedBody = JSON.parse(res.body);
|
2016-06-13 22:14:01 +08:00
|
|
|
assert.deepEqual(parsedBody.errors, ["Missing layers array from layergroup config"]);
|
2015-07-08 05:46:58 +08:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("post layergroup jsonp errors are returned with 200 status", function(done) {
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map?callback=test',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
2015-07-08 05:46:58 +08:00
|
|
|
}, {}, function(res) {
|
|
|
|
assert.equal(res.statusCode, 200);
|
2015-09-17 08:06:32 +08:00
|
|
|
assert.equal(
|
|
|
|
res.body,
|
2016-06-13 22:14:01 +08:00
|
|
|
'/**/ typeof test === \'function\' && ' +
|
|
|
|
'test({"errors":["Missing layers array from layergroup config"],' +
|
2017-12-14 02:46:35 +08:00
|
|
|
'"errors_with_context":[{"type":"unknown",' +
|
2016-06-27 00:43:04 +08:00
|
|
|
'"message":"Missing layers array from layergroup config"}]});'
|
2015-09-17 08:06:32 +08:00
|
|
|
);
|
2015-07-08 05:46:58 +08:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("layergroup with no cartocss_version", function(done) {
|
2018-03-17 01:15:37 +08:00
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.0',
|
|
|
|
layers: [
|
|
|
|
{ options: {
|
|
|
|
sql: 'select cartodb_id, ST_Translate(the_geom, 50, 0) as the_geom from test_table limit 2',
|
|
|
|
cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
} }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2018-03-17 01:15:37 +08:00
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
}, {}, function(res) {
|
|
|
|
assert.equal(res.statusCode, 400, res.body);
|
|
|
|
var parsedBody = JSON.parse(res.body);
|
|
|
|
assert.deepEqual(parsedBody.errors, ["Missing cartocss_version for layer 0 options"]);
|
|
|
|
done();
|
|
|
|
});
|
2015-07-08 05:46:58 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it("sql/cartocss combination errors", function(done) {
|
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.1',
|
|
|
|
layers: [{ options: {
|
|
|
|
sql: "select 1 as i, 'LINESTRING(0 0, 1 0)'::geometry as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#layer [missing=1] { line-width:16; }',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}}]
|
|
|
|
};
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
2015-07-08 05:46:58 +08:00
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
}, {}, function(res) {
|
|
|
|
try {
|
|
|
|
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
|
|
|
// See http://github.com/CartoDB/Windshaft/issues/159
|
|
|
|
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);
|
|
|
|
// cannot check for error starting with style0 until a new enough mapnik
|
|
|
|
// is used: https://github.com/mapnik/mapnik/issues/1924
|
|
|
|
//assert.ok(error.match(/^style0/), "Error doesn't start with style0: " + error);
|
|
|
|
// TODO: check which layer introduced the problem ?
|
|
|
|
done();
|
|
|
|
} catch (err) { done(err); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("sql/interactivity combination error", function(done) {
|
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.1',
|
|
|
|
layers: [
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, st_setsrid('LINESTRING(0 0, 1 0)'::geometry, 4326) as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#layer { line-width:16; }',
|
|
|
|
interactivity: 'i',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}},
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, st_setsrid('LINESTRING(0 0, 1 0)'::geometry, 4326) as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#layer { line-width:16; }',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}},
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, st_setsrid('LINESTRING(0 0, 1 0)'::geometry, 4326) as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#layer { line-width:16; }',
|
|
|
|
interactivity: 'missing',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}}
|
|
|
|
]
|
|
|
|
};
|
2017-05-26 19:13:19 +08:00
|
|
|
this.client = new TestClient(layergroup);
|
2017-12-05 19:09:31 +08:00
|
|
|
this.client.getLayergroup({ response: { status: 400 } }, function(err, parsed) {
|
2017-05-26 19:13:19 +08:00
|
|
|
assert.ok(!err, err);
|
|
|
|
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);
|
|
|
|
done();
|
2015-07-08 05:46:58 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("blank CartoCSS error", function(done) {
|
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.1',
|
|
|
|
layers: [
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, 'LINESTRING(0 0, 1 0)'::geometry as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#style { line-width:16 }',
|
|
|
|
interactivity: 'i',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}},
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, 'LINESTRING(0 0, 1 0)'::geometry as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '',
|
|
|
|
interactivity: 'i',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
2015-07-08 05:46:58 +08:00
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
}, {}, function(res) {
|
|
|
|
try {
|
|
|
|
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
|
|
|
var parsed = JSON.parse(res.body);
|
|
|
|
assert.ok(parsed);
|
|
|
|
assert.equal(parsed.errors.length, 1);
|
|
|
|
var error = parsed.errors[0];
|
|
|
|
assert.ok(error.match(/^style1: CartoCSS is empty/), error);
|
|
|
|
done();
|
|
|
|
} catch (err) { done(err); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Invalid mapnik-geometry-type CartoCSS error", function(done) {
|
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.1',
|
|
|
|
layers: [
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, 'LINESTRING(0 0, 1 0)'::geometry as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#style [mapnik-geometry-type=bogus] { line-width:16 }',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}},
|
|
|
|
{ options: {
|
|
|
|
sql: "select 1 as i, 'LINESTRING(0 0, 1 0)'::geometry as the_geom",
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
cartocss: '#style [mapnik-geometry-type=bogus] { line-width:16 }',
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
}}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
2015-07-08 05:46:58 +08:00
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
}, {}, function(res) {
|
|
|
|
try {
|
|
|
|
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
|
|
|
var parsed = JSON.parse(res.body);
|
|
|
|
assert.ok(parsed);
|
|
|
|
assert.equal(parsed.errors.length, 1);
|
|
|
|
var error = parsed.errors[0];
|
|
|
|
// carto-0.9.3 used to say "Failed to parse expression",
|
|
|
|
// carto-0.9.5 says "not a valid keyword"
|
|
|
|
assert.ok(error.match(/^style0:.*(Failed|not a valid)/), error);
|
|
|
|
// TODO: check which layer introduced the problem ?
|
|
|
|
done();
|
|
|
|
} catch (err) { done(err); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("post'ing style with non existent column in filter returns 400 with error", function(done) {
|
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.1',
|
|
|
|
layers: [
|
|
|
|
{ options: {
|
|
|
|
sql: 'select * from test_table limit 1',
|
2016-11-05 18:43:39 +08:00
|
|
|
cartocss: '#test_table::outline[address="one"], [address="two"] { marker-fill: red; }',
|
2015-07-08 05:46:58 +08:00
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
interactivity: [ 'cartodb_id' ],
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
} },
|
|
|
|
{ options: {
|
|
|
|
sql: 'select * from test_big_poly limit 1',
|
|
|
|
cartocss: '#test_big_poly { marker-fill:blue }',
|
|
|
|
cartocss_version: '2.0.2',
|
|
|
|
interactivity: [ 'cartodb_id' ],
|
|
|
|
geom_column: 'the_geom'
|
|
|
|
} }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
2018-03-17 01:15:37 +08:00
|
|
|
headers: {
|
|
|
|
host: 'localhost',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
2015-07-08 05:46:58 +08:00
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
}, {}, function(res) {
|
|
|
|
assert.equal(res.statusCode, 400, res.body);
|
|
|
|
var parsed = JSON.parse(res.body);
|
|
|
|
assert.equal(parsed.errors.length, 1);
|
|
|
|
var error = parsed.errors[0];
|
2016-11-05 18:43:39 +08:00
|
|
|
assert.ok(error.match(/column "address" does not exist/m), error);
|
2015-07-08 05:46:58 +08:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// See https://github.com/Vizzuality/Windshaft/issues/31
|
|
|
|
it('bogus sql raises 400 status code', function(done) {
|
|
|
|
var bogusSqlMapConfig = testClient.singleLayerMapConfig('BOGUS FROM test_table');
|
|
|
|
testClient.createLayergroup(bogusSqlMapConfig, { statusCode: 400 }, function(err, res) {
|
|
|
|
assert.ok(/syntax error/.test(res.body), "Unexpected error: " + res.body);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('bogus sql raises 200 status code for jsonp', function(done) {
|
|
|
|
var bogusSqlMapConfig = testClient.singleLayerMapConfig('bogus');
|
|
|
|
var options = {
|
|
|
|
method: 'GET',
|
|
|
|
callbackName: 'test',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'text/javascript; charset=utf-8'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
testClient.createLayergroup(bogusSqlMapConfig, options, function(err, res) {
|
2015-09-17 08:06:32 +08:00
|
|
|
assert.ok(
|
|
|
|
/^\/\*\*\/ typeof test === 'function' && test\(/.test(res.body),
|
|
|
|
"Body start expected callback name: " + res.body
|
|
|
|
);
|
2015-07-08 05:46:58 +08:00
|
|
|
assert.ok(/syntax error/.test(res.body), "Unexpected error: " + res.body);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('query not selecting the_geom raises 200 status code for jsonp instead of 404', function(done) {
|
|
|
|
var noGeomMapConfig = testClient.singleLayerMapConfig('select null::geometry the_geom_wadus');
|
|
|
|
var options = {
|
|
|
|
method: 'GET',
|
|
|
|
callbackName: 'test',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'text/javascript; charset=utf-8'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
testClient.createLayergroup(noGeomMapConfig, options, function(err, res) {
|
2015-09-17 08:06:32 +08:00
|
|
|
assert.ok(
|
|
|
|
/^\/\*\*\/ typeof test === 'function' && test\(/.test(res.body),
|
|
|
|
"Body start expected callback name: " + res.body
|
|
|
|
);
|
2015-07-08 05:46:58 +08:00
|
|
|
assert.ok(/column.*does not exist/.test(res.body), "Unexpected error: " + res.body);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("query with no geometry field returns 400 status", function(done){
|
|
|
|
var noGeometrySqlMapConfig = testClient.singleLayerMapConfig('SELECT 1');
|
|
|
|
testClient.createLayergroup(noGeometrySqlMapConfig, { statusCode: 400 }, function(err, res) {
|
|
|
|
assert.ok(/column.*does not exist/.test(res.body), "Unexpected error: " + res.body);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("bogus style should raise 400 status", function(done){
|
|
|
|
var bogusStyleMapConfig = testClient.defaultTableMapConfig('test_table', '#test_table{xxxxx;}');
|
|
|
|
testClient.createLayergroup(bogusStyleMapConfig, { method: 'GET', statusCode: 400 }, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
var defaultErrorExpectedResponse = {
|
|
|
|
status: 400,
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json; charset=utf-8'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
it('should raise 400 error for out of bounds layer index', function(done){
|
|
|
|
var mapConfig = testClient.singleLayerMapConfig('select * from test_table', null, null, 'name');
|
|
|
|
|
|
|
|
testClient.getGrid(mapConfig, 1, 13, 4011, 3088, defaultErrorExpectedResponse, function(err, res) {
|
2016-06-13 22:14:01 +08:00
|
|
|
assert.deepEqual(JSON.parse(res.body).errors, ["Layer '1' not found in layergroup"]);
|
2015-09-26 01:07:57 +08:00
|
|
|
done();
|
2015-07-08 05:46:58 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// OPTIONS LAYERGROUP
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
it("nonexistent layergroup token error", function(done) {
|
|
|
|
step(
|
|
|
|
function do_get_tile(err)
|
|
|
|
{
|
|
|
|
assert.ifError(err);
|
|
|
|
var next = this;
|
|
|
|
assert.response(server, {
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map/deadbeef/0/0/0/0.grid.json',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'GET',
|
2018-03-17 01:15:37 +08:00
|
|
|
encoding: 'binary',
|
|
|
|
headers: {
|
|
|
|
host: 'localhost'
|
|
|
|
}
|
2015-07-08 05:46:58 +08:00
|
|
|
}, {}, function(res, err) { next(err, res); });
|
|
|
|
},
|
|
|
|
function checkResponse(err, res) {
|
|
|
|
assert.ifError(err);
|
|
|
|
// FIXME: should be 404
|
|
|
|
assert.equal(res.statusCode, 400, res.statusCode + ':' + res.body);
|
|
|
|
var parsed = JSON.parse(res.body);
|
2016-06-13 22:14:01 +08:00
|
|
|
assert.deepEqual(parsed.errors, ["Invalid or nonexistent map configuration token 'deadbeef'"]);
|
2015-07-08 05:46:58 +08:00
|
|
|
return null;
|
|
|
|
},
|
|
|
|
function finish(err) {
|
|
|
|
done(err);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('error 400 on json syntax error', function(done) {
|
|
|
|
var layergroup = {
|
|
|
|
version: '1.0.1',
|
|
|
|
layers: [
|
|
|
|
{
|
|
|
|
options: {
|
|
|
|
sql: 'select the_geom from test_table limit 1',
|
|
|
|
cartocss: '#layer { marker-fill:red }'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
assert.response(server,
|
|
|
|
{
|
2019-10-02 01:34:03 +08:00
|
|
|
url: '/api/v1/map',
|
2015-07-08 05:46:58 +08:00
|
|
|
method: 'POST',
|
|
|
|
headers: {'Content-Type': 'application/json; charset=utf-8' },
|
|
|
|
data: '{' + JSON.stringify(layergroup)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
status: 400
|
|
|
|
},
|
|
|
|
function(res) {
|
|
|
|
var parsedBody = JSON.parse(res.body);
|
2017-02-17 20:36:15 +08:00
|
|
|
assert.ok(parsedBody.errors);
|
|
|
|
assert.equal(parsedBody.errors.length, 1);
|
|
|
|
assert.ok(parsedBody.errors[0].match(/^SyntaxError: Unexpected token {/));
|
2015-07-08 05:46:58 +08:00
|
|
|
done();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|