Merge branch 'develop' of github.com:Vizzuality/CartoDB-SQL-API into develop

This commit is contained in:
javi 2013-07-04 16:14:51 +02:00
commit 320e0b97a8
2 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,7 @@ var typeNames = {
20: 'number',
21: 'number',
23: 'number',
25: 'string',
25: 'string', // text
26: 'number',
114: 'object', // JSON
701: 'number',

View File

@ -841,7 +841,8 @@ test('field names and types are exposed', function(done){
assert.response(app, {
url: '/api/v1/sql?' + querystring.stringify({
q: "SELECT 1::int as a, 2::float8 as b, 3::varchar as c, " +
"4::char as d, now() as e, 'POINT(0 0)'::geometry as the_geom " +
"4::char as d, now() as e, 'a'::text as f, " +
"'POINT(0 0)'::geometry as the_geom " +
"LIMIT 0"
}),
headers: {host: 'vizzuality.cartodb.com'},
@ -849,12 +850,13 @@ test('field names and types are exposed', function(done){
},{ }, function(res) {
assert.equal(res.statusCode, 200, res.body);
var parsedBody = JSON.parse(res.body);
assert.equal(_.keys(parsedBody.fields).length, 6);
assert.equal(_.keys(parsedBody.fields).length, 7);
assert.equal(parsedBody.fields.a.type, 'number');
assert.equal(parsedBody.fields.b.type, 'number');
assert.equal(parsedBody.fields.c.type, 'string');
assert.equal(parsedBody.fields.d.type, 'string');
assert.equal(parsedBody.fields.e.type, 'date');
assert.equal(parsedBody.fields.f.type, 'string');
assert.equal(parsedBody.fields.the_geom.type, 'geometry');
done();
});