CartoDB-SQL-API/test/acceptance/query-multipart.js

25 lines
787 B
JavaScript
Raw Normal View History

2018-05-04 16:50:14 +08:00
require('../helper');
2018-05-04 21:27:56 +08:00
const server = require('../../app/server')();
const assert = require('../support/assert');
2018-05-04 16:50:14 +08:00
describe('query-multipart', function() {
2018-05-09 00:38:57 +08:00
it('make query from a multipart form', function(done){
2018-05-04 16:50:14 +08:00
assert.response(server, {
url: '/api/v1/sql',
formData: {
q: 'SELECT 2 as n'
},
headers: {host: 'vizzuality.cartodb.com'},
method: 'POST'
},{}, function(err, res) {
assert.ifError(err);
const response = JSON.parse(res.body);
2018-05-23 03:24:19 +08:00
assert.equal(typeof(response.time) !== 'undefined', true);
2018-05-04 16:50:14 +08:00
assert.strictEqual(response.total_rows, 1);
assert.deepStrictEqual(response.rows, [{n:2}]);
done();
});
});
});