CartoDB-SQL-API/test/acceptance/export/folder-test.js

36 lines
991 B
JavaScript
Raw Normal View History

2018-10-24 21:42:33 +08:00
'use strict';
2018-08-30 18:50:50 +08:00
require('../../helper');
require('../../support/assert');
2018-08-30 21:10:43 +08:00
const fs = require('fs');
let server = require('../../../lib/server');
2018-08-30 18:50:50 +08:00
const assert = require('assert');
const querystring = require('querystring');
2018-08-30 21:06:07 +08:00
describe('export folder', function() {
2018-08-30 18:50:50 +08:00
it('folder exists', function(done){
const currentTmpDir = global.settings.tmpDir;
2018-08-30 21:10:43 +08:00
const dynamicTmpDir = `/tmp/${new Date().getTime()}/a/b/c`;
global.settings.tmpDir = dynamicTmpDir;
2018-08-30 18:50:50 +08:00
server = server();
assert.response(server, {
url: '/api/v1/sql?' + querystring.stringify({
q: 'SELECT 1',
}),
headers: { host: 'vizzuality.cartodb.com' },
method: 'GET'
}, {}, function(err, res) {
assert.ifError(err);
assert.ok(res.statusCode === 200);
2018-08-30 21:10:43 +08:00
assert.ok(fs.existsSync(dynamicTmpDir));
2018-08-30 18:50:50 +08:00
global.settings.tmpDir = currentTmpDir;
done();
});
});
});