Use asert.strict mode
This commit is contained in:
parent
9b4a45da02
commit
cc535b13d2
@ -24,7 +24,7 @@ JobStateMachine.prototype.isValidTransition = function (initialStatus, finalStat
|
|||||||
|
|
||||||
for (var i = 0; i < validStatusTransitions.length; i++) {
|
for (var i = 0; i < validStatusTransitions.length; i++) {
|
||||||
try {
|
try {
|
||||||
assert.deepEqual(transition, validStatusTransitions[i]);
|
assert.deepStrictEqual(transition, validStatusTransitions[i]);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -56,7 +56,7 @@ describe('app.auth', function () {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.statusCode, scenario.statusCode, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, scenario.statusCode, res.statusCode + ': ' + res.body);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -35,7 +35,7 @@ describe('app-configuration', function () {
|
|||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
var sqlapi_version = require(__dirname + '/../../package.json').version;
|
var sqlapi_version = require(__dirname + '/../../package.json').version;
|
||||||
assert.ok(parsed.hasOwnProperty('cartodb_sql_api'), "No 'cartodb_sql_api' version in " + parsed);
|
assert.ok(parsed.hasOwnProperty('cartodb_sql_api'), "No 'cartodb_sql_api' version in " + parsed);
|
||||||
assert.equal(parsed.cartodb_sql_api, sqlapi_version);
|
assert.strictEqual(parsed.cartodb_sql_api, sqlapi_version);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -48,9 +48,9 @@ describe('app-configuration', function () {
|
|||||||
}, {
|
}, {
|
||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.deepEqual(JSON.parse(res.body), { error: ['You must indicate a sql query'] });
|
assert.deepStrictEqual(JSON.parse(res.body), { error: ['You must indicate a sql query'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -71,15 +71,15 @@ describe('app-configuration', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
res.headers['access-control-allow-headers'],
|
res.headers['access-control-allow-headers'],
|
||||||
accessControlHeaders
|
accessControlHeaders
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
res.headers['access-control-expose-headers'],
|
res.headers['access-control-expose-headers'],
|
||||||
exposedHeaders
|
exposedHeaders
|
||||||
);
|
);
|
||||||
assert.equal(res.headers['access-control-allow-origin'], '*');
|
assert.strictEqual(res.headers['access-control-allow-origin'], '*');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -91,16 +91,16 @@ describe('app-configuration', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'OPTIONS'
|
method: 'OPTIONS'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
assert.equal(res.body, '');
|
assert.strictEqual(res.body, '');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
res.headers['access-control-allow-headers'],
|
res.headers['access-control-allow-headers'],
|
||||||
accessControlHeaders
|
accessControlHeaders
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
res.headers['access-control-expose-headers'],
|
res.headers['access-control-expose-headers'],
|
||||||
exposedHeaders
|
exposedHeaders
|
||||||
);
|
);
|
||||||
assert.equal(res.headers['access-control-allow-origin'], '*');
|
assert.strictEqual(res.headers['access-control-allow-origin'], '*');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -115,8 +115,8 @@ describe('app-configuration', function () {
|
|||||||
// Check cache headers
|
// Check cache headers
|
||||||
assert.ok(res.headers.hasOwnProperty('x-cache-channel'));
|
assert.ok(res.headers.hasOwnProperty('x-cache-channel'));
|
||||||
// See https://github.com/CartoDB/CartoDB-SQL-API/issues/105
|
// See https://github.com/CartoDB/CartoDB-SQL-API/issues/105
|
||||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
||||||
assert.equal(res.headers['cache-control'], expected_cache_control_persist);
|
assert.strictEqual(res.headers['cache-control'], expected_cache_control_persist);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -133,8 +133,8 @@ describe('app-configuration', function () {
|
|||||||
global.settings.db_host = backupDBHost;
|
global.settings.db_host = backupDBHost;
|
||||||
try {
|
try {
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.equal(parsed.rows.length, 1);
|
assert.strictEqual(parsed.rows.length, 1);
|
||||||
assert.equal(parsed.rows[0].n, 2);
|
assert.strictEqual(parsed.rows[0].n, 2);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return done(e);
|
return done(e);
|
||||||
}
|
}
|
||||||
@ -153,10 +153,10 @@ describe('app-configuration', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
global.settings.db_user_pass = backupDBUserPass;
|
global.settings.db_user_pass = backupDBUserPass;
|
||||||
try {
|
try {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.equal(parsed.rows.length, 1);
|
assert.strictEqual(parsed.rows.length, 1);
|
||||||
assert.equal(parsed.rows[0].n, 2);
|
assert.strictEqual(parsed.rows[0].n, 2);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return done(e);
|
return done(e);
|
||||||
}
|
}
|
||||||
@ -174,14 +174,14 @@ describe('app-configuration', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
||||||
assert.equal(res.headers['cache-control'], expected_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_cache_control);
|
||||||
assert.equal(res.headers['access-control-allow-origin'], '*');
|
assert.strictEqual(res.headers['access-control-allow-origin'], '*');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
res.headers['access-control-allow-headers'],
|
res.headers['access-control-allow-headers'],
|
||||||
accessControlHeaders
|
accessControlHeaders
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
res.headers['access-control-expose-headers'],
|
res.headers['access-control-expose-headers'],
|
||||||
exposedHeaders
|
exposedHeaders
|
||||||
);
|
);
|
||||||
|
@ -36,10 +36,10 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
||||||
assert.equal(res.headers['cache-control'], expected_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -50,7 +50,7 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ describe('app.test', function () {
|
|||||||
url: '/user/vizzuality/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4',
|
url: '/user/vizzuality/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -72,10 +72,10 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
||||||
assert.equal(res.headers['cache-control'], expected_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -87,7 +87,7 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -100,9 +100,9 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {
|
}, {
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 403, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 403, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.ok(JSON.parse(res.body).error[0].match(/permission denied for .+? untitle_table_4/));
|
assert.ok(JSON.parse(res.body).error[0].match(/permission denied for .+? untitle_table_4/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -115,9 +115,9 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {
|
}, {
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.ok(JSON.parse(res.body).error[0].match(/must be owner of.+? untitle_table_4/));
|
assert.ok(JSON.parse(res.body).error[0].match(/must be owner of.+? untitle_table_4/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -139,9 +139,9 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.ok(JSON.parse(res.body).error[0].match(/must be owner of.+? untitle_table_4/));
|
assert.ok(JSON.parse(res.body).error[0].match(/must be owner of.+? untitle_table_4/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -160,8 +160,8 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.localhost.lan:8080' },
|
headers: { host: 'vizzuality.localhost.lan:8080' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.private_table');
|
assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.private_table');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -175,11 +175,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -193,11 +193,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -212,10 +212,10 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.total_rows, 1);
|
assert.strictEqual(parsedBody.total_rows, 1);
|
||||||
assert.deepEqual(parsedBody.rows[0], { b: 2.5 });
|
assert.deepStrictEqual(parsedBody.rows[0], { b: 2.5 });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -229,11 +229,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
var pbody = JSON.parse(res.body);
|
var pbody = JSON.parse(res.body);
|
||||||
assert.equal(pbody.rows.length, 0);
|
assert.strictEqual(pbody.rows.length, 0);
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/api/v1/sql?' + querystring.stringify({
|
url: '/api/v1/sql?' + querystring.stringify({
|
||||||
q: 'SELECT count(*) FROM test_table',
|
q: 'SELECT count(*) FROM test_table',
|
||||||
@ -242,7 +242,7 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// table should not get a cache channel as it won't get invalidated
|
// table should not get a cache channel as it won't get invalidated
|
||||||
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
|
||||||
|
|
||||||
@ -254,8 +254,8 @@ describe('app.test', function () {
|
|||||||
assert.ok(Number(value) <= fallbackTtl);
|
assert.ok(Number(value) <= fallbackTtl);
|
||||||
|
|
||||||
var pbody = JSON.parse(res.body);
|
var pbody = JSON.parse(res.body);
|
||||||
assert.equal(pbody.total_rows, 1);
|
assert.strictEqual(pbody.total_rows, 1);
|
||||||
assert.equal(pbody.rows[0].count, 0);
|
assert.strictEqual(pbody.rows[0].count, 0);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -270,11 +270,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
var pbody = JSON.parse(res.body);
|
var pbody = JSON.parse(res.body);
|
||||||
assert.equal(pbody.rows.length, 0);
|
assert.strictEqual(pbody.rows.length, 0);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -288,11 +288,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -306,11 +306,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -324,11 +324,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -339,10 +339,10 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.body);
|
assert.strictEqual(res.statusCode, 400, res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.deepEqual(JSON.parse(res.body), { error: ['Invalid format: unknown'] });
|
assert.deepStrictEqual(JSON.parse(res.body), { error: ['Invalid format: unknown'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -353,12 +353,12 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var ct = res.headers['content-type'];
|
var ct = res.headers['content-type'];
|
||||||
assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct);
|
assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^inline/.test(cd), 'Default format is not disposed inline: ' + cd);
|
assert.strictEqual(true, /^inline/.test(cd), 'Default format is not disposed inline: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.json/gi.test(cd), 'Unexpected JSON filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.json/gi.test(cd), 'Unexpected JSON filename: ' + cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -370,12 +370,12 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var ct = res.headers['content-type'];
|
var ct = res.headers['content-type'];
|
||||||
assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct);
|
assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^inline/.test(cd), 'Default format is not disposed inline: ' + cd);
|
assert.strictEqual(true, /^inline/.test(cd), 'Default format is not disposed inline: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.json/gi.test(cd), 'Unexpected JSON filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.json/gi.test(cd), 'Unexpected JSON filename: ' + cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -386,12 +386,12 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var ct = res.headers['content-type'];
|
var ct = res.headers['content-type'];
|
||||||
assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct);
|
assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'Format with filename is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'Format with filename is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=x.json/gi.test(cd), 'Unexpected JSON filename: ' + cd);
|
assert.strictEqual(true, /filename=x.json/gi.test(cd), 'Unexpected JSON filename: ' + cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -405,9 +405,9 @@ describe('app.test', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var cd = res.headers['access-control-allow-origin'];
|
var cd = res.headers['access-control-allow-origin'];
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.equal(cd, '*');
|
assert.strictEqual(cd, '*');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -418,11 +418,11 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzualinot.cartodb.com' },
|
headers: { host: 'vizzualinot.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 404, res.statusCode + (res.statusCode !== 200 ? (': ' + res.body) : ''));
|
assert.strictEqual(res.statusCode, 404, res.statusCode + (res.statusCode !== 200 ? (': ' + res.body) : ''));
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
var result = JSON.parse(res.body);
|
var result = JSON.parse(res.body);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
result.error[0],
|
result.error[0],
|
||||||
"Sorry, we can't find CARTO user 'vizzualinot'. Please check that you have entered the correct domain."
|
"Sorry, we can't find CARTO user 'vizzualinot'. Please check that you have entered the correct domain."
|
||||||
);
|
);
|
||||||
@ -440,12 +440,12 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
var result = JSON.parse(res.body);
|
var result = JSON.parse(res.body);
|
||||||
// NOTE: actual error message may be slighly different, possibly worth a regexp here
|
// NOTE: actual error message may be slighly different, possibly worth a regexp here
|
||||||
assert.equal(result.error[0], 'syntax error at or near "and"');
|
assert.strictEqual(result.error[0], 'syntax error at or near "and"');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -460,16 +460,17 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.localhost.lan:8080' },
|
headers: { host: 'vizzuality.localhost.lan:8080' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(Object.prototype.hasOwnProperty.call(out, 'time'));
|
||||||
assert.equal(out.total_rows, 1);
|
assert.strictEqual(out.total_rows, 1);
|
||||||
assert.equal(out.rows.length, 1);
|
assert.strictEqual(out.rows.length, 1);
|
||||||
assert.ok(out.rows[0].hasOwnProperty('x'));
|
assert.ok(Object.prototype.hasOwnProperty.call(out.rows[0], 'x'));
|
||||||
assert.equal(out.rows[0].x.length, 2);
|
assert.strictEqual(out.rows[0].x.length, 2);
|
||||||
assert.equal(out.rows[0].x[0], '8.7');
|
assert.strictEqual(out.rows[0].x[0], 8.7);
|
||||||
assert.equal(out.rows[0].x[1], '4.3');
|
assert.strictEqual(out.rows[0].x[1], 4.3);
|
||||||
assert.equal(res.headers.hasOwnProperty('x-cache-channel'), false);
|
assert.strictEqual(Object.prototype.hasOwnProperty.call(res.headers, 'x-cache-channel'), false);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -490,19 +491,19 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(_.keys(parsedBody.fields).length, 10);
|
assert.strictEqual(_.keys(parsedBody.fields).length, 10);
|
||||||
assert.equal(parsedBody.fields.a.type, 'number');
|
assert.strictEqual(parsedBody.fields.a.type, 'number');
|
||||||
assert.equal(parsedBody.fields.b.type, 'number');
|
assert.strictEqual(parsedBody.fields.b.type, 'number');
|
||||||
assert.equal(parsedBody.fields.c.type, 'string');
|
assert.strictEqual(parsedBody.fields.c.type, 'string');
|
||||||
assert.equal(parsedBody.fields.d.type, 'string');
|
assert.strictEqual(parsedBody.fields.d.type, 'string');
|
||||||
assert.equal(parsedBody.fields.e.type, 'date');
|
assert.strictEqual(parsedBody.fields.e.type, 'date');
|
||||||
assert.equal(parsedBody.fields.f.type, 'string');
|
assert.strictEqual(parsedBody.fields.f.type, 'string');
|
||||||
assert.equal(parsedBody.fields.g.type, 'boolean');
|
assert.strictEqual(parsedBody.fields.g.type, 'boolean');
|
||||||
assert.equal(parsedBody.fields.h.type, 'geometry');
|
assert.strictEqual(parsedBody.fields.h.type, 'geometry');
|
||||||
assert.equal(parsedBody.fields.i.type, 'date');
|
assert.strictEqual(parsedBody.fields.i.type, 'date');
|
||||||
assert.equal(parsedBody.fields.j.type, 'number');
|
assert.strictEqual(parsedBody.fields.j.type, 'number');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -526,21 +527,21 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
var row = parsedBody.rows[0];
|
var row = parsedBody.rows[0];
|
||||||
assert.equal(typeof (row.a), 'number');
|
assert.strictEqual(typeof (row.a), 'number');
|
||||||
assert.equal(typeof (row.b), 'number');
|
assert.strictEqual(typeof (row.b), 'number');
|
||||||
assert.equal(typeof (row.c), 'number');
|
assert.strictEqual(typeof (row.c), 'number');
|
||||||
assert.equal(typeof (row.d), 'number');
|
assert.strictEqual(typeof (row.d), 'number');
|
||||||
assert.equal(typeof (row.e), 'number');
|
assert.strictEqual(typeof (row.e), 'number');
|
||||||
assert.equal(typeof (row.f), 'number');
|
assert.strictEqual(typeof (row.f), 'number');
|
||||||
assert.equal(typeof (row._a[0]), 'number');
|
assert.strictEqual(typeof (row._a[0]), 'number');
|
||||||
assert.equal(typeof (row._b[0]), 'number');
|
assert.strictEqual(typeof (row._b[0]), 'number');
|
||||||
assert.equal(typeof (row._c[0]), 'number');
|
assert.strictEqual(typeof (row._c[0]), 'number');
|
||||||
assert.equal(typeof (row._d[0]), 'number');
|
assert.strictEqual(typeof (row._d[0]), 'number');
|
||||||
assert.equal(typeof (row._e[0]), 'number');
|
assert.strictEqual(typeof (row._e[0]), 'number');
|
||||||
assert.equal(typeof (row._f[0]), 'number');
|
assert.strictEqual(typeof (row._f[0]), 'number');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -568,9 +569,9 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
try {
|
try {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.rows[0].d, '2000-01-01T00:00:00+0100');
|
assert.strictEqual(parsedBody.rows[0].d, '2000-01-01T00:00:00+0100');
|
||||||
next();
|
next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
next(err);
|
next(err);
|
||||||
@ -588,9 +589,9 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
try {
|
try {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.rows[0].d, '2000-01-01T00:00:00+0100');
|
assert.strictEqual(parsedBody.rows[0].d, '2000-01-01T00:00:00+0100');
|
||||||
next();
|
next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
next(err);
|
next(err);
|
||||||
@ -608,9 +609,9 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
try {
|
try {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.rows[0].d, '2000-01-01T01:00:00+0100');
|
assert.strictEqual(parsedBody.rows[0].d, '2000-01-01T01:00:00+0100');
|
||||||
next();
|
next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
next(err);
|
next(err);
|
||||||
@ -628,9 +629,9 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
try {
|
try {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.rows[0].d, '2000-01-01T00:00:00+0100');
|
assert.strictEqual(parsedBody.rows[0].d, '2000-01-01T00:00:00+0100');
|
||||||
next();
|
next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
next(err);
|
next(err);
|
||||||
@ -672,8 +673,8 @@ describe('app.test', function () {
|
|||||||
try {
|
try {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result');
|
assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result');
|
||||||
assert.equal(parsedBody.notices.length, 1);
|
assert.strictEqual(parsedBody.notices.length, 1);
|
||||||
assert.equal(parsedBody.notices[0], 'hello notice');
|
assert.strictEqual(parsedBody.notices[0], 'hello notice');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return next(e);
|
return next(e);
|
||||||
}
|
}
|
||||||
@ -693,8 +694,8 @@ describe('app.test', function () {
|
|||||||
try {
|
try {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result');
|
assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result');
|
||||||
assert.equal(parsedBody.warnings.length, 1);
|
assert.strictEqual(parsedBody.warnings.length, 1);
|
||||||
assert.equal(parsedBody.warnings[0], 'hello warning');
|
assert.strictEqual(parsedBody.warnings[0], 'hello warning');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return next(e);
|
return next(e);
|
||||||
}
|
}
|
||||||
@ -715,11 +716,11 @@ describe('app.test', function () {
|
|||||||
try {
|
try {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result');
|
assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result');
|
||||||
assert.equal(parsedBody.warnings.length, 1);
|
assert.strictEqual(parsedBody.warnings.length, 1);
|
||||||
assert.equal(parsedBody.warnings[0], 'hello again warning');
|
assert.strictEqual(parsedBody.warnings[0], 'hello again warning');
|
||||||
assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result');
|
assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result');
|
||||||
assert.equal(parsedBody.notices.length, 1);
|
assert.strictEqual(parsedBody.notices.length, 1);
|
||||||
assert.equal(parsedBody.notices[0], 'hello again notice');
|
assert.strictEqual(parsedBody.notices[0], 'hello again notice');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return next(e);
|
return next(e);
|
||||||
}
|
}
|
||||||
@ -736,7 +737,7 @@ describe('app.test', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
try {
|
try {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
JSON.parse(res.body);
|
JSON.parse(res.body);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = new Error(err + ',' + e);
|
err = new Error(err + ',' + e);
|
||||||
@ -753,7 +754,7 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.ok(res.body.match(/foo\_jsonp\(.*\)/));
|
assert.ok(res.body.match(/foo\_jsonp\(.*\)/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -765,7 +766,7 @@ describe('app.test', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
var didRunJsonCallback = false;
|
var didRunJsonCallback = false;
|
||||||
// jshint ignore:start
|
// jshint ignore:start
|
||||||
function foo_jsonp (body) {
|
function foo_jsonp (body) {
|
||||||
@ -793,7 +794,7 @@ describe('app.test', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error.error, [
|
assert.deepStrictEqual(error.error, [
|
||||||
'You are over platform\'s limits: SQL query timeout error.' +
|
'You are over platform\'s limits: SQL query timeout error.' +
|
||||||
' Refactor your query before running again or contact CARTO support for more details.'
|
' Refactor your query before running again or contact CARTO support for more details.'
|
||||||
]);
|
]);
|
||||||
@ -816,7 +817,7 @@ describe('app.test', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error.error, [
|
assert.deepStrictEqual(error.error, [
|
||||||
'You are over platform\'s limits: SQL query timeout error.' +
|
'You are over platform\'s limits: SQL query timeout error.' +
|
||||||
' Refactor your query before running again or contact CARTO support for more details.'
|
' Refactor your query before running again or contact CARTO support for more details.'
|
||||||
]);
|
]);
|
||||||
@ -839,7 +840,7 @@ describe('app.test', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error.error, [
|
assert.deepStrictEqual(error.error, [
|
||||||
'You are over platform\'s limits: SQL query timeout error.' +
|
'You are over platform\'s limits: SQL query timeout error.' +
|
||||||
' Refactor your query before running again or contact CARTO support for more details.'
|
' Refactor your query before running again or contact CARTO support for more details.'
|
||||||
]);
|
]);
|
||||||
@ -874,11 +875,11 @@ describe('app.test', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
assert.equal(hit, true);
|
assert.strictEqual(hit, true);
|
||||||
var parsedError = JSON.parse(consoleError);
|
var parsedError = JSON.parse(consoleError);
|
||||||
assert.ok(parsedError.error.match(/^row too large.*/i), 'Expecting row size limit error');
|
assert.ok(parsedError.error.match(/^row too large.*/i), 'Expecting row size limit error');
|
||||||
assert.equal(parsedError.username, 'vizzuality');
|
assert.strictEqual(parsedError.username, 'vizzuality');
|
||||||
assert.equal(parsedError.type, 'row_size_limit_exceeded');
|
assert.strictEqual(parsedError.type, 'row_size_limit_exceeded');
|
||||||
|
|
||||||
global.settings.db_max_row_size = dbMaxRowSize;
|
global.settings.db_max_row_size = dbMaxRowSize;
|
||||||
console.error = consoleErrorFn;
|
console.error = consoleErrorFn;
|
||||||
|
@ -15,7 +15,7 @@ describe('Auth API', function () {
|
|||||||
this.testClient = new TestClient();
|
this.testClient = new TestClient();
|
||||||
this.testClient.getResult(publicSQL, (err, result) => {
|
this.testClient.getResult(publicSQL, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.length, 6);
|
assert.strictEqual(result.length, 6);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -31,7 +31,7 @@ describe('Auth API', function () {
|
|||||||
|
|
||||||
this.testClient.getResult(publicSQL, expectedResponse, (err, result) => {
|
this.testClient.getResult(publicSQL, expectedResponse, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.error, 'Unauthorized');
|
assert.deepStrictEqual(result.error, ['Unauthorized']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -55,7 +55,7 @@ describe('Auth API', function () {
|
|||||||
this.testClient = new TestClient({ apiKey: 1234 });
|
this.testClient = new TestClient({ apiKey: 1234 });
|
||||||
this.testClient.getResult(publicSQL, (err, result) => {
|
this.testClient.getResult(publicSQL, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.length, 6);
|
assert.strictEqual(result.length, 6);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -64,7 +64,7 @@ describe('Auth API', function () {
|
|||||||
this.testClient = new TestClient({ apiKey: 1234 });
|
this.testClient = new TestClient({ apiKey: 1234 });
|
||||||
this.testClient.getResult(privateSQL, (err, result) => {
|
this.testClient.getResult(privateSQL, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.length, 5);
|
assert.strictEqual(result.length, 5);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -73,7 +73,7 @@ describe('Auth API', function () {
|
|||||||
this.testClient = new TestClient({ apiKey: 'regular1' });
|
this.testClient = new TestClient({ apiKey: 'regular1' });
|
||||||
this.testClient.getResult(scopedSQL, (err, result) => {
|
this.testClient.getResult(scopedSQL, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.length, 4);
|
assert.strictEqual(result.length, 4);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -107,7 +107,7 @@ describe('Auth API', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -123,7 +123,7 @@ describe('Auth API', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = JSON.parse(response.body);
|
const body = JSON.parse(response.body);
|
||||||
assert.equal(body.error, 'permission denied');
|
assert.deepStrictEqual(body.error, ['permission denied']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -137,7 +137,7 @@ describe('Auth API', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = JSON.parse(response.body);
|
const body = JSON.parse(response.body);
|
||||||
assert.equal(body.error, 'permission denied');
|
assert.deepStrictEqual(body.error, ['permission denied']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -151,7 +151,7 @@ describe('Auth API', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = JSON.parse(response.body);
|
const body = JSON.parse(response.body);
|
||||||
assert.equal(body.error, 'permission denied');
|
assert.deepStrictEqual(body.error, ['permission denied']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -167,7 +167,7 @@ describe('Auth API', function () {
|
|||||||
|
|
||||||
this.testClient.getResult(scopedSQL, { anonymous: true }, (err, result) => {
|
this.testClient.getResult(scopedSQL, { anonymous: true }, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.length, 4);
|
assert.strictEqual(result.length, 4);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -199,7 +199,7 @@ describe('Auth API', function () {
|
|||||||
|
|
||||||
this.testClient.getResult(systemSQL, expectedResponse, (err, result) => {
|
this.testClient.getResult(systemSQL, expectedResponse, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.error, 'system tables are forbidden');
|
assert.deepStrictEqual(result.error, ['system tables are forbidden']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -215,7 +215,7 @@ describe('Auth API', function () {
|
|||||||
|
|
||||||
this.testClient.getResult(scopedSQL, expectedResponse, (err, result) => {
|
this.testClient.getResult(scopedSQL, expectedResponse, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.error, 'permission denied');
|
assert.deepStrictEqual(result.error, ['permission denied']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -232,7 +232,7 @@ describe('Auth API', function () {
|
|||||||
|
|
||||||
this.testClient.getResult(publicSQL, expectedResponse, (err, result) => {
|
this.testClient.getResult(publicSQL, expectedResponse, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.error, 'Unauthorized');
|
assert.deepStrictEqual(result.error, ['Unauthorized']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -247,7 +247,7 @@ describe('Auth API', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = JSON.parse(response.body);
|
const body = JSON.parse(response.body);
|
||||||
assert.equal(body.error, 'permission denied');
|
assert.deepStrictEqual(body.error, ['permission denied']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -261,7 +261,7 @@ describe('Auth API', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = JSON.parse(response.body);
|
const body = JSON.parse(response.body);
|
||||||
assert.equal(body.error, 'permission denied');
|
assert.deepStrictEqual(body.error, ['permission denied']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ describe('backend crash', function () {
|
|||||||
},
|
},
|
||||||
function checkResponse (err, res) {
|
function checkResponse (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(res.statusCode, 500, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 500, res.statusCode + ': ' + res.body);
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.ok(parsed.error);
|
assert.ok(parsed.error);
|
||||||
var msg = parsed.error[0];
|
var msg = parsed.error[0];
|
||||||
@ -51,7 +51,7 @@ describe('backend crash', function () {
|
|||||||
},
|
},
|
||||||
function checkResponse (err, res) {
|
function checkResponse (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(res.statusCode, 500, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 500, res.statusCode + ': ' + res.body);
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.ok(parsed.error);
|
assert.ok(parsed.error);
|
||||||
var msg = parsed.error[0];
|
var msg = parsed.error[0];
|
||||||
|
@ -66,14 +66,14 @@ describe('batch module', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, 'running');
|
assert.strictEqual(job.status, 'running');
|
||||||
|
|
||||||
self.batch.drain(function () {
|
self.batch.drain(function () {
|
||||||
jobBackend.get(job.job_id, function (err, job) {
|
jobBackend.get(job.job_id, function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, 'pending');
|
assert.strictEqual(job.status, 'pending');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -41,7 +41,7 @@ describe('batch query statement_timeout limit', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
assert.ok(job.failed_reason.match(/statement.*timeout/));
|
assert.ok(job.failed_reason.match(/statement.*timeout/));
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,7 @@ describe('batch multiquery', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -59,7 +59,7 @@ describe('batch multiquery', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -81,7 +81,7 @@ describe('batch multiquery', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -103,7 +103,7 @@ describe('batch multiquery', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -142,7 +142,7 @@ describe('batch multiquery', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jobsCreated.forEach(function (job) {
|
jobsCreated.forEach(function (job) {
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
@ -185,7 +185,7 @@ describe('batch multiquery', function () {
|
|||||||
var statuses = jobsCreated.map(function (job) {
|
var statuses = jobsCreated.map(function (job) {
|
||||||
return job.status;
|
return job.status;
|
||||||
});
|
});
|
||||||
assert.deepEqual(statuses, expectedStatus);
|
assert.deepStrictEqual(statuses, expectedStatus);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -227,7 +227,7 @@ describe('batch multiquery', function () {
|
|||||||
var statuses = jobsCreated.map(function (job) {
|
var statuses = jobsCreated.map(function (job) {
|
||||||
return job.status;
|
return job.status;
|
||||||
});
|
});
|
||||||
assert.deepEqual(statuses, expectedStatus);
|
assert.deepStrictEqual(statuses, expectedStatus);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ describe('batch happy cases', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -50,7 +50,7 @@ describe('batch happy cases', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -66,7 +66,7 @@ describe('batch happy cases', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -100,7 +100,7 @@ describe('batch happy cases', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jobsCreated.forEach(function (job) {
|
jobsCreated.forEach(function (job) {
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
@ -135,7 +135,7 @@ describe('batch happy cases', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jobsCreated.forEach(function (job) {
|
jobsCreated.forEach(function (job) {
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
});
|
});
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
@ -154,7 +154,7 @@ describe('batch happy cases', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -172,7 +172,7 @@ describe('batch happy cases', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -190,7 +190,7 @@ describe('batch happy cases', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -63,8 +63,8 @@ describe('Batch API callback templates', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(rows[0].job_id, job.job_id);
|
assert.strictEqual(rows[0].job_id, job.job_id);
|
||||||
assert.equal(rows[0].error_message, 'relation "invalid_table" does not exist');
|
assert.strictEqual(rows[0].error_message, 'relation "invalid_table" does not exist');
|
||||||
self.testClient.getResult('drop table test_batch_errors', done);
|
self.testClient.getResult('drop table test_batch_errors', done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -117,7 +117,7 @@ describe('Batch API callback templates', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(rows[0].job_id, job.job_id);
|
assert.strictEqual(rows[0].job_id, job.job_id);
|
||||||
|
|
||||||
self.testClient.getResult('drop table batch_jobs', done);
|
self.testClient.getResult('drop table batch_jobs', done);
|
||||||
});
|
});
|
||||||
|
@ -41,7 +41,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -74,7 +74,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -109,7 +109,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -144,7 +144,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -177,8 +177,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.equal(job.fallback_status, JobStatus.DONE);
|
assert.strictEqual(job.fallback_status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -212,8 +212,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
assert.equal(job.fallback_status, JobStatus.SKIPPED);
|
assert.strictEqual(job.fallback_status, JobStatus.SKIPPED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -247,8 +247,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
assert.equal(job.fallback_status, JobStatus.DONE);
|
assert.strictEqual(job.fallback_status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -281,8 +281,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.equal(job.fallback_status, JobStatus.SKIPPED);
|
assert.strictEqual(job.fallback_status, JobStatus.SKIPPED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -318,8 +318,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.equal(job.fallback_status, JobStatus.DONE);
|
assert.strictEqual(job.fallback_status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -361,7 +361,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -404,7 +404,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -447,7 +447,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -489,7 +489,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -524,7 +524,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -558,7 +558,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -600,7 +600,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -643,7 +643,7 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -687,8 +687,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.equal(job.fallback_status, JobStatus.DONE);
|
assert.strictEqual(job.fallback_status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -734,8 +734,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.equal(job.fallback_status, JobStatus.DONE);
|
assert.strictEqual(job.fallback_status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -780,8 +780,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
assert.equal(job.fallback_status, JobStatus.FAILED);
|
assert.strictEqual(job.fallback_status, JobStatus.FAILED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -830,8 +830,8 @@ describe('Batch API fallback job', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
assert.equal(job.fallback_status, JobStatus.DONE);
|
assert.strictEqual(job.fallback_status, JobStatus.DONE);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -869,15 +869,15 @@ describe('Batch API fallback job', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.RUNNING);
|
assert.strictEqual(job.status, JobStatus.RUNNING);
|
||||||
|
|
||||||
jobResult.cancel(function (err, job) {
|
jobResult.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
assert.equal(job.fallback_status, JobStatus.SKIPPED);
|
assert.strictEqual(job.fallback_status, JobStatus.SKIPPED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -915,15 +915,15 @@ describe('Batch API fallback job', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.RUNNING);
|
assert.strictEqual(job.status, JobStatus.RUNNING);
|
||||||
|
|
||||||
jobResult.cancel(function (err, job) {
|
jobResult.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
assert.equal(job.fallback_status, JobStatus.SKIPPED);
|
assert.strictEqual(job.fallback_status, JobStatus.SKIPPED);
|
||||||
jobResult.validateExpectedResponse(expectedQuery);
|
jobResult.validateExpectedResponse(expectedQuery);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
@ -53,7 +53,7 @@ describe('job query limit', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: [expectedErrorMessage(queryTooLong)] });
|
assert.deepStrictEqual(error, { error: [expectedErrorMessage(queryTooLong)] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -88,7 +88,7 @@ describe('job query limit', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: [expectedErrorMessage(queries)] });
|
assert.deepStrictEqual(error, { error: [expectedErrorMessage(queries)] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -114,7 +114,7 @@ describe('job query limit', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: [expectedErrorMessage(fallbackQueries)] });
|
assert.deepStrictEqual(error, { error: [expectedErrorMessage(fallbackQueries)] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -42,8 +42,8 @@ describe('job query order', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job1.status, JobStatus.DONE);
|
assert.strictEqual(job1.status, JobStatus.DONE);
|
||||||
assert.equal(job2.status, JobStatus.DONE);
|
assert.strictEqual(job2.status, JobStatus.DONE);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
new Date(job1.updated_at).getTime() < new Date(job2.updated_at).getTime(),
|
new Date(job1.updated_at).getTime() < new Date(job2.updated_at).getTime(),
|
||||||
'job1 (' + job1.updated_at + ') should finish before job2 (' + job2.updated_at + ')'
|
'job1 (' + job1.updated_at + ') should finish before job2 (' + job2.updated_at + ')'
|
||||||
|
@ -40,7 +40,7 @@ describe('job query timeout', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -56,7 +56,7 @@ describe('job query timeout', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -73,7 +73,7 @@ describe('job query timeout', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -90,7 +90,7 @@ describe('job query timeout', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job.status, JobStatus.FAILED);
|
assert.strictEqual(job.status, JobStatus.FAILED);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -40,10 +40,10 @@ describe('job module', function () {
|
|||||||
status: 201
|
status: 201
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
job = JSON.parse(res.body);
|
job = JSON.parse(res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.ok(job.job_id);
|
assert.ok(job.job_id);
|
||||||
assert.equal(job.query, 'SELECT * FROM untitle_table_4');
|
assert.strictEqual(job.query, 'SELECT * FROM untitle_table_4');
|
||||||
assert.equal(job.user, 'vizzuality');
|
assert.strictEqual(job.user, 'vizzuality');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -59,7 +59,7 @@ describe('job module', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: ['You must indicate a valid SQL'] });
|
assert.deepStrictEqual(error, { error: ['You must indicate a valid SQL'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -76,7 +76,7 @@ describe('job module', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: ['You must indicate a valid SQL'] });
|
assert.deepStrictEqual(error, { error: ['You must indicate a valid SQL'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -93,7 +93,7 @@ describe('job module', function () {
|
|||||||
status: 401
|
status: 401
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: ['Unauthorized'] });
|
assert.deepStrictEqual(error, { error: ['Unauthorized'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -110,7 +110,7 @@ describe('job module', function () {
|
|||||||
status: 404
|
status: 404
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, {
|
assert.deepStrictEqual(error, {
|
||||||
error: [
|
error: [
|
||||||
'Sorry, we can\'t find CARTO user \'wrong-host\'. ' +
|
'Sorry, we can\'t find CARTO user \'wrong-host\'. ' +
|
||||||
'Please check that you have entered the correct domain.'
|
'Please check that you have entered the correct domain.'
|
||||||
@ -129,9 +129,9 @@ describe('job module', function () {
|
|||||||
status: 200
|
status: 200
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var jobGot = JSON.parse(res.body);
|
var jobGot = JSON.parse(res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.equal(jobGot.query, 'SELECT * FROM untitle_table_4');
|
assert.strictEqual(jobGot.query, 'SELECT * FROM untitle_table_4');
|
||||||
assert.equal(jobGot.user, 'vizzuality');
|
assert.strictEqual(jobGot.user, 'vizzuality');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -145,7 +145,7 @@ describe('job module', function () {
|
|||||||
status: 401
|
status: 401
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: ['Unauthorized'] });
|
assert.deepStrictEqual(error, { error: ['Unauthorized'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -159,7 +159,7 @@ describe('job module', function () {
|
|||||||
status: 400
|
status: 400
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, {
|
assert.deepStrictEqual(error, {
|
||||||
error: ['Job with id irrelevantJob not found']
|
error: ['Job with id irrelevantJob not found']
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
@ -175,11 +175,11 @@ describe('job module', function () {
|
|||||||
status: 200
|
status: 200
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var jobCancelled = JSON.parse(res.body);
|
var jobCancelled = JSON.parse(res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.equal(jobCancelled.job_id, job.job_id);
|
assert.strictEqual(jobCancelled.job_id, job.job_id);
|
||||||
assert.equal(jobCancelled.query, 'SELECT * FROM untitle_table_4');
|
assert.strictEqual(jobCancelled.query, 'SELECT * FROM untitle_table_4');
|
||||||
assert.equal(jobCancelled.user, 'vizzuality');
|
assert.strictEqual(jobCancelled.user, 'vizzuality');
|
||||||
assert.equal(jobCancelled.status, 'cancelled');
|
assert.strictEqual(jobCancelled.status, 'cancelled');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -193,7 +193,7 @@ describe('job module', function () {
|
|||||||
status: 401
|
status: 401
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, { error: ['Unauthorized'] });
|
assert.deepStrictEqual(error, { error: ['Unauthorized'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -207,7 +207,7 @@ describe('job module', function () {
|
|||||||
status: 404
|
status: 404
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
var error = JSON.parse(res.body);
|
var error = JSON.parse(res.body);
|
||||||
assert.deepEqual(error, {
|
assert.deepStrictEqual(error, {
|
||||||
error: [
|
error: [
|
||||||
'Sorry, we can\'t find CARTO user \'wrong-host\'. ' +
|
'Sorry, we can\'t find CARTO user \'wrong-host\'. ' +
|
||||||
'Please check that you have entered the correct domain.'
|
'Please check that you have entered the correct domain.'
|
||||||
|
@ -64,13 +64,13 @@ describe('multiple batch clients job query order', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(job1.status, JobStatus.DONE);
|
assert.strictEqual(job1.status, JobStatus.DONE);
|
||||||
assert.equal(job2.status, JobStatus.DONE);
|
assert.strictEqual(job2.status, JobStatus.DONE);
|
||||||
|
|
||||||
self.testClient.getResult('select * from ordered_inserts', function (err, rows) {
|
self.testClient.getResult('select * from ordered_inserts', function (err, rows) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
|
||||||
assert.deepEqual(rows, [{ status: 1 }, { status: 2 }, { status: 3 }]);
|
assert.deepStrictEqual(rows, [{ status: 1 }, { status: 2 }, { status: 3 }]);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
new Date(job1.updated_at).getTime() < new Date(job2.updated_at).getTime(),
|
new Date(job1.updated_at).getTime() < new Date(job2.updated_at).getTime(),
|
||||||
'job1 (' + job1.updated_at + ') should finish before job2 (' + job2.updated_at + ')'
|
'job1 (' + job1.updated_at + ') should finish before job2 (' + job2.updated_at + ')'
|
||||||
|
@ -82,9 +82,9 @@ describe('multiple batch clients and users, job query order', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
jobResultB1.getStatus(function (err, jobB1) {
|
jobResultB1.getStatus(function (err, jobB1) {
|
||||||
assert.equal(jobA1.status, JobStatus.DONE);
|
assert.strictEqual(jobA1.status, JobStatus.DONE);
|
||||||
assert.equal(jobA2.status, JobStatus.DONE);
|
assert.strictEqual(jobA2.status, JobStatus.DONE);
|
||||||
assert.equal(jobB1.status, JobStatus.DONE);
|
assert.strictEqual(jobB1.status, JobStatus.DONE);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
new Date(jobA1.updated_at).getTime() < new Date(jobA2.updated_at).getTime(),
|
new Date(jobA1.updated_at).getTime() < new Date(jobA2.updated_at).getTime(),
|
||||||
@ -104,14 +104,14 @@ describe('multiple batch clients and users, job query order', function () {
|
|||||||
|
|
||||||
// cartodb250user and vizzuality test users share database
|
// cartodb250user and vizzuality test users share database
|
||||||
var expectedRows = [1, 2, 3].map(statusMapper);
|
var expectedRows = [1, 2, 3].map(statusMapper);
|
||||||
assert.deepEqual(rows, expectedRows);
|
assert.deepStrictEqual(rows, expectedRows);
|
||||||
|
|
||||||
var query = 'select * from ordered_inserts_bbbbb';
|
var query = 'select * from ordered_inserts_bbbbb';
|
||||||
self.testClient.getResult(query, override, function (err, rows) {
|
self.testClient.getResult(query, override, function (err, rows) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
|
||||||
var expectedRows = [1].map(statusMapper);
|
var expectedRows = [1].map(statusMapper);
|
||||||
assert.deepEqual(rows, expectedRows);
|
assert.deepStrictEqual(rows, expectedRows);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -57,7 +57,7 @@ describe('max queued jobs', function () {
|
|||||||
|
|
||||||
createJob(self.server, 400, function (err, res) {
|
createJob(self.server, 400, function (err, res) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
assert.equal(res.error[0], 'Failed to create job. Max number of jobs (' +
|
assert.strictEqual(res.error[0], 'Failed to create job. Max number of jobs (' +
|
||||||
global.settings.batch_max_queued_jobs + ') queued reached');
|
global.settings.batch_max_queued_jobs + ') queued reached');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -70,8 +70,8 @@ describe('basic scheduling', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(jobA1.status, JobStatus.DONE);
|
assert.strictEqual(jobA1.status, JobStatus.DONE);
|
||||||
assert.equal(jobA2.status, JobStatus.DONE);
|
assert.strictEqual(jobA2.status, JobStatus.DONE);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
new Date(jobA1.updated_at).getTime() < new Date(jobA2.updated_at).getTime(),
|
new Date(jobA1.updated_at).getTime() < new Date(jobA2.updated_at).getTime(),
|
||||||
@ -86,7 +86,7 @@ describe('basic scheduling', function () {
|
|||||||
|
|
||||||
// cartodb250user and vizzuality test users share database
|
// cartodb250user and vizzuality test users share database
|
||||||
var expectedRows = [1, 2, 3].map(statusMapper);
|
var expectedRows = [1, 2, 3].map(statusMapper);
|
||||||
assert.deepEqual(rows, expectedRows);
|
assert.deepStrictEqual(rows, expectedRows);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
@ -30,10 +30,10 @@ describe('Use cases', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
|
|
||||||
jobResult.tryCancel(function (err, body) {
|
jobResult.tryCancel(function (err, body) {
|
||||||
assert.equal(body.error[0], 'Cannot set status from done to cancelled');
|
assert.strictEqual(body.error[0], 'Cannot set status from done to cancelled');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -55,17 +55,17 @@ describe('Use cases', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.RUNNING);
|
assert.strictEqual(job.status, JobStatus.RUNNING);
|
||||||
|
|
||||||
jobResult.cancel(function (err, job) {
|
jobResult.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
|
|
||||||
jobResult.tryCancel(function (err, body) {
|
jobResult.tryCancel(function (err, body) {
|
||||||
assert.equal(body.error[0], 'Cannot set status from cancelled to cancelled');
|
assert.strictEqual(body.error[0], 'Cannot set status from cancelled to cancelled');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -98,21 +98,21 @@ describe('Use cases', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.PENDING);
|
assert.strictEqual(job.status, JobStatus.PENDING);
|
||||||
|
|
||||||
jobResult2.cancel(function (err, job) {
|
jobResult2.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
|
|
||||||
jobResult1.cancel(function (err, job) {
|
jobResult1.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -136,14 +136,14 @@ describe('Use cases', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.RUNNING);
|
assert.strictEqual(job.status, JobStatus.RUNNING);
|
||||||
|
|
||||||
jobResult.cancel(function (err, job) {
|
jobResult.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -169,17 +169,17 @@ describe('Use cases', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.RUNNING);
|
assert.strictEqual(job.status, JobStatus.RUNNING);
|
||||||
|
|
||||||
jobResult.cancel(function (err, job) {
|
jobResult.cancel(function (err, job) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.CANCELLED);
|
assert.strictEqual(job.status, JobStatus.CANCELLED);
|
||||||
|
|
||||||
jobResult.tryCancel(function (err, body) {
|
jobResult.tryCancel(function (err, body) {
|
||||||
assert.equal(body.error[0], 'Cannot set status from cancelled to cancelled');
|
assert.strictEqual(body.error[0], 'Cannot set status from cancelled to cancelled');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@ describe('cache headers', function () {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.headers.vary, 'Authorization');
|
assert.strictEqual(res.headers.vary, 'Authorization');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -42,7 +42,7 @@ describe('cache headers', function () {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.headers['cache-control'], `no-cache,max-age=${noTtl},must-revalidate,public`);
|
assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${noTtl},must-revalidate,public`);
|
||||||
|
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: `/api/v1/sql?${qs.encode({
|
url: `/api/v1/sql?${qs.encode({
|
||||||
@ -72,7 +72,7 @@ describe('cache headers', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {},
|
}, {},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`);
|
assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`);
|
||||||
|
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: `/api/v1/sql?${qs.encode({
|
url: `/api/v1/sql?${qs.encode({
|
||||||
@ -85,7 +85,7 @@ describe('cache headers', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {},
|
}, {},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`);
|
assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -109,7 +109,7 @@ describe('cache headers', function () {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`);
|
assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,7 @@ function countInsertedRows (host, port, callback) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
const result = JSON.parse(body);
|
const result = JSON.parse(body);
|
||||||
callback(null, result);
|
callback(null, result);
|
||||||
});
|
});
|
||||||
@ -88,7 +88,7 @@ describe('Cancel "copy to" commands', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -110,7 +110,7 @@ describe('Cancel "copy to" commands', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -141,7 +141,7 @@ describe('Cancel "copy to" commands', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(result.rows[0].count, 1);
|
assert.strictEqual(result.rows[0].count, 1);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -169,7 +169,7 @@ describe('Cancel "copy to" commands', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(result.rows[0].count, 1);
|
assert.strictEqual(result.rows[0].count, 1);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -203,7 +203,7 @@ describe('Cancel "copy to" commands', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(result.rows[0].count, 1);
|
assert.strictEqual(result.rows[0].count, 1);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -231,7 +231,7 @@ describe('Cancel "copy to" commands', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(result.rows[0].count, 1);
|
assert.strictEqual(result.rows[0].count, 1);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@ describe('copy-endpoints', function () {
|
|||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.equal(!!response.time, true);
|
assert.strictEqual(!!response.time, true);
|
||||||
assert.strictEqual(response.total_rows, 2016);
|
assert.strictEqual(response.total_rows, 2016);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -88,7 +88,7 @@ describe('copy-endpoints', function () {
|
|||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error: ['relation \"unexisting_table\" does not exist']
|
error: ['relation \"unexisting_table\" does not exist']
|
||||||
@ -107,7 +107,7 @@ describe('copy-endpoints', function () {
|
|||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error: ['No rows copied']
|
error: ['No rows copied']
|
||||||
@ -125,7 +125,7 @@ describe('copy-endpoints', function () {
|
|||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error: ['SQL is missing']
|
error: ['SQL is missing']
|
||||||
@ -158,8 +158,8 @@ describe('copy-endpoints', function () {
|
|||||||
const regex = /11\tPaul\t10\n12\tPeter\t10\n13\tMatthew\t10\n14\t\\N\t10\n15\tJames\t10\n16\t*/g;
|
const regex = /11\tPaul\t10\n12\tPeter\t10\n13\tMatthew\t10\n14\t\\N\t10\n15\tJames\t10\n16\t*/g;
|
||||||
assert.ok(res.body.match(regex));
|
assert.ok(res.body.match(regex));
|
||||||
|
|
||||||
assert.equal(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp');
|
assert.strictEqual(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp');
|
||||||
assert.equal(res.headers['content-type'], 'application/octet-stream');
|
assert.strictEqual(res.headers['content-type'], 'application/octet-stream');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -195,8 +195,8 @@ describe('copy-endpoints', function () {
|
|||||||
const regex = /11\tPaul\t10\n12\tPeter\t10\n13\tMatthew\t10\n14\t\\N\t10\n15\tJames\t10\n16\t*/g;
|
const regex = /11\tPaul\t10\n12\tPeter\t10\n13\tMatthew\t10\n14\t\\N\t10\n15\tJames\t10\n16\t*/g;
|
||||||
assert.ok(res.body.match(regex));
|
assert.ok(res.body.match(regex));
|
||||||
|
|
||||||
assert.equal(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp');
|
assert.strictEqual(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp');
|
||||||
assert.equal(res.headers['content-type'], 'application/octet-stream');
|
assert.strictEqual(res.headers['content-type'], 'application/octet-stream');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -212,7 +212,7 @@ describe('copy-endpoints', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error: ['SQL is missing']
|
error: ['SQL is missing']
|
||||||
@ -236,7 +236,7 @@ describe('copy-endpoints', function () {
|
|||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.equal(!!response.time, true);
|
assert.strictEqual(!!response.time, true);
|
||||||
assert.strictEqual(response.total_rows, 6);
|
assert.strictEqual(response.total_rows, 6);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -255,7 +255,7 @@ describe('copy-endpoints', function () {
|
|||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error: ['Error while gunzipping: incorrect header check']
|
error: ['Error while gunzipping: incorrect header check']
|
||||||
@ -292,7 +292,7 @@ describe('copy-endpoints', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(JSON.parse(res.body), {
|
assert.deepStrictEqual(JSON.parse(res.body), {
|
||||||
error: [
|
error: [
|
||||||
'You are over platform\'s limits: SQL query timeout error.' +
|
'You are over platform\'s limits: SQL query timeout error.' +
|
||||||
' Refactor your query before running again or contact CARTO support for more details.'
|
' Refactor your query before running again or contact CARTO support for more details.'
|
||||||
@ -321,7 +321,7 @@ describe('copy-endpoints', function () {
|
|||||||
detail: 'datasource'
|
detail: 'datasource'
|
||||||
};
|
};
|
||||||
const expectedError = res.body.substring(res.body.length - JSON.stringify(error).length);
|
const expectedError = res.body.substring(res.body.length - JSON.stringify(error).length);
|
||||||
assert.deepEqual(JSON.parse(expectedError), error);
|
assert.deepStrictEqual(JSON.parse(expectedError), error);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -572,7 +572,7 @@ describe('copy-endpoints', function () {
|
|||||||
headers: { 'Content-Type': 'application/json; charset=utf-8' }
|
headers: { 'Content-Type': 'application/json; charset=utf-8' }
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.deepEqual(response, { error: ['DB Quota exceeded'] });
|
assert.deepStrictEqual(response, { error: ['DB Quota exceeded'] });
|
||||||
|
|
||||||
setTimeout(() => assertCanReuseCanceledConnection(done), CLIENT_DISCONNECT_TIMEOUT);
|
setTimeout(() => assertCanReuseCanceledConnection(done), CLIENT_DISCONNECT_TIMEOUT);
|
||||||
});
|
});
|
||||||
@ -623,7 +623,7 @@ describe('copy-endpoints', function () {
|
|||||||
headers: { 'Content-Type': 'application/json; charset=utf-8' }
|
headers: { 'Content-Type': 'application/json; charset=utf-8' }
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.deepEqual(response, { error: ['COPY FROM maximum POST size of 10 bytes exceeded'] });
|
assert.deepStrictEqual(response, { error: ['COPY FROM maximum POST size of 10 bytes exceeded'] });
|
||||||
|
|
||||||
setTimeout(() => assertCanReuseCanceledConnection(done), CLIENT_DISCONNECT_TIMEOUT);
|
setTimeout(() => assertCanReuseCanceledConnection(done), CLIENT_DISCONNECT_TIMEOUT);
|
||||||
});
|
});
|
||||||
|
@ -45,10 +45,10 @@ describe('copy-statements', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
// We expect a problem, actually
|
// We expect a problem, actually
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.deepEqual(JSON.parse(res.body), { error: ['COPY from stdin failed: No source stream defined'] });
|
assert.deepStrictEqual(JSON.parse(res.body), { error: ['COPY from stdin failed: No source stream defined'] });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -63,9 +63,9 @@ describe('copy-statements', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
// We expect a problem, actually
|
// We expect a problem, actually
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
const error_exp = /must be superuser.* to COPY.* a file/;
|
const error_exp = /must be superuser.* to COPY.* a file/;
|
||||||
const hint_exp = /Anyone can COPY to stdout or from stdin. psql's \\copy command also works for anyone./;
|
const hint_exp = /Anyone can COPY to stdout or from stdin. psql's \\copy command also works for anyone./;
|
||||||
assert.ok(JSON.parse(res.body).error[0].match(error_exp));
|
assert.ok(JSON.parse(res.body).error[0].match(error_exp));
|
||||||
|
@ -80,7 +80,7 @@ describe('COPY FROM throttle', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -130,9 +130,9 @@ describe('COPY FROM throttle', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(res.statusCode, 400);
|
assert.strictEqual(res.statusCode, 400);
|
||||||
body = JSON.parse(body);
|
body = JSON.parse(body);
|
||||||
assert.deepEqual(body, { error: ['Connection closed by server: input data too slow'] });
|
assert.deepStrictEqual(body, { error: ['Connection closed by server: input data too slow'] });
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -157,7 +157,7 @@ describe('COPY FROM throttle', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -17,8 +17,8 @@ describe('export.arraybuffer', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.equal(res.headers['content-type'], 'application/octet-stream');
|
assert.strictEqual(res.headers['content-type'], 'application/octet-stream');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -32,9 +32,9 @@ describe('export.arraybuffer', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.body);
|
assert.strictEqual(res.statusCode, 400, res.body);
|
||||||
var result = JSON.parse(res.body);
|
var result = JSON.parse(res.body);
|
||||||
assert.equal(result.error[0], 'geometry types are not supported');
|
assert.strictEqual(result.error[0], 'geometry types are not supported');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -17,19 +17,19 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.csv/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.csv/gi.test(cd));
|
||||||
var ct = res.headers['content-type'];
|
var ct = res.headers['content-type'];
|
||||||
assert.equal(true, /header=present/.test(ct), "CSV doesn't advertise header presence: " + ct);
|
assert.strictEqual(true, /header=present/.test(ct), "CSV doesn't advertise header presence: " + ct);
|
||||||
|
|
||||||
var rows = res.body.split(/\r\n/);
|
var rows = res.body.split(/\r\n/);
|
||||||
var row0 = rows[0].split(',');
|
var row0 = rows[0].split(',');
|
||||||
var row1 = rows[1].split(',');
|
var row1 = rows[1].split(',');
|
||||||
|
|
||||||
assert.equal(row0[2], 'created_at');
|
assert.strictEqual(row0[2], 'created_at');
|
||||||
assert.equal(row1[2], '2011-09-21 14:02:21.314252');
|
assert.strictEqual(row1[2], '2011-09-21 14:02:21.314252');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -57,12 +57,12 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.csv/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.csv/gi.test(cd));
|
||||||
var ct = res.headers['content-type'];
|
var ct = res.headers['content-type'];
|
||||||
assert.equal(true, /header=present/.test(ct), "CSV doesn't advertise header presence: " + ct);
|
assert.strictEqual(true, /header=present/.test(ct), "CSV doesn't advertise header presence: " + ct);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -73,12 +73,12 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=mycsv.csv/gi.test(cd), cd);
|
assert.strictEqual(true, /filename=mycsv.csv/gi.test(cd), cd);
|
||||||
var ct = res.headers['content-type'];
|
var ct = res.headers['content-type'];
|
||||||
assert.equal(true, /header=present/.test(ct), "CSV doesn't advertise header presence: " + ct);
|
assert.strictEqual(true, /header=present/.test(ct), "CSV doesn't advertise header presence: " + ct);
|
||||||
var row0 = res.body.substring(0, res.body.search(/[\n\r]/)).split(',');
|
var row0 = res.body.substring(0, res.body.search(/[\n\r]/)).split(',');
|
||||||
var checkFields = { name: true, cartodb_id: true, the_geom: true, the_geom_webmercator: true };
|
var checkFields = { name: true, cartodb_id: true, the_geom: true, the_geom_webmercator: true };
|
||||||
Object.keys(checkFields).forEach(function (f) {
|
Object.keys(checkFields).forEach(function (f) {
|
||||||
@ -100,7 +100,7 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var row0 = res.body.substring(0, res.body.search(/[\n\r]/)).split(',');
|
var row0 = res.body.substring(0, res.body.search(/[\n\r]/)).split(',');
|
||||||
var checkFields = { name: true, cartodb_id: false, the_geom: true, the_geom_webmercator: true };
|
var checkFields = { name: true, cartodb_id: false, the_geom: true, the_geom_webmercator: true };
|
||||||
Object.keys(checkFields).forEach(function (f) {
|
Object.keys(checkFields).forEach(function (f) {
|
||||||
@ -122,7 +122,7 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.ok(res.body.match(/cartodb_id,geom\r\n.?1.?,"SRID=4326;POINT(.*)"\r\n/));
|
assert.ok(res.body.match(/cartodb_id,geom\r\n.?1.?,"SRID=4326;POINT(.*)"\r\n/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -135,7 +135,7 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var obtained_lines = res.body.split('\r\n');
|
var obtained_lines = res.body.split('\r\n');
|
||||||
assert.ok(obtained_lines.length <= 2, // may or may not have an header
|
assert.ok(obtained_lines.length <= 2, // may or may not have an header
|
||||||
// See http://trac.osgeo.org/gdal/ticket/5234
|
// See http://trac.osgeo.org/gdal/ticket/5234
|
||||||
@ -150,7 +150,7 @@ describe('export.csv', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.ok(res.body.match(/cartodb_id,address\r\n.?1.?,"Calle de Pérez Galdós 9, Madrid, Spain"\r\n/));
|
assert.ok(res.body.match(/cartodb_id,address\r\n.?1.?,"Calle de Pérez Galdós 9, Madrid, Spain"\r\n/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -196,7 +196,7 @@ describe('export.csv', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var headersPlusExtraLine = 2;
|
var headersPlusExtraLine = 2;
|
||||||
assert.equal(res.body.split('\n').length, limit + headersPlusExtraLine);
|
assert.strictEqual(res.body.split('\n').length, limit + headersPlusExtraLine);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -25,10 +25,10 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -40,10 +40,10 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -54,9 +54,9 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -67,9 +67,9 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /filename=x.geojson/gi.test(cd), cd);
|
assert.strictEqual(true, /filename=x.geojson/gi.test(cd), cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -80,7 +80,7 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsed_body = JSON.parse(res.body);
|
var parsed_body = JSON.parse(res.body);
|
||||||
var row0 = parsed_body.features[0].properties;
|
var row0 = parsed_body.features[0].properties;
|
||||||
var checkfields = { name: 1, cartodb_id: 1, the_geom: 0, the_geom_webmercator: 0 };
|
var checkfields = { name: 1, cartodb_id: 1, the_geom: 0, the_geom_webmercator: 0 };
|
||||||
@ -101,7 +101,7 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var parsed_body = JSON.parse(res.body);
|
var parsed_body = JSON.parse(res.body);
|
||||||
var row0 = parsed_body.features[0].properties;
|
var row0 = parsed_body.features[0].properties;
|
||||||
var checkfields = { name: 1, cartodb_id: 0, the_geom: 0, the_geom_webmercator: 0 };
|
var checkfields = { name: 1, cartodb_id: 0, the_geom: 0, the_geom_webmercator: 0 };
|
||||||
@ -126,9 +126,9 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var result = JSON.parse(res.body);
|
var result = JSON.parse(res.body);
|
||||||
assert.equal(1, checkDecimals(result.features[0].geometry.coordinates[0], '.'));
|
assert.strictEqual(1, checkDecimals(result.features[0].geometry.coordinates[0], '.'));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -142,9 +142,9 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var result = JSON.parse(res.body);
|
var result = JSON.parse(res.body);
|
||||||
assert.equal(6, checkDecimals(result.features[0].geometry.coordinates[0], '.'));
|
assert.strictEqual(6, checkDecimals(result.features[0].geometry.coordinates[0], '.'));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -158,10 +158,10 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd));
|
||||||
var gjson = JSON.parse(res.body);
|
var gjson = JSON.parse(res.body);
|
||||||
var expected = {
|
var expected = {
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
@ -171,7 +171,7 @@ describe('export.geojson', function () {
|
|||||||
geometry: null
|
geometry: null
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
assert.deepEqual(gjson, expected);
|
assert.deepStrictEqual(gjson, expected);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -185,10 +185,10 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.body);
|
assert.strictEqual(res.statusCode, 400, res.body);
|
||||||
var geoJson = JSON.parse(res.body);
|
var geoJson = JSON.parse(res.body);
|
||||||
assert.ok(geoJson.error);
|
assert.ok(geoJson.error);
|
||||||
assert.equal(geoJson.error.length, 1);
|
assert.strictEqual(geoJson.error.length, 1);
|
||||||
assert.ok(geoJson.error[0].match(/^syntax error at or near.*/));
|
assert.ok(geoJson.error[0].match(/^syntax error at or near.*/));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -203,10 +203,10 @@ describe('export.geojson', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var geoJson = JSON.parse(res.body);
|
var geoJson = JSON.parse(res.body);
|
||||||
var expectedGeoJson = { type: 'FeatureCollection', features: [] };
|
var expectedGeoJson = { type: 'FeatureCollection', features: [] };
|
||||||
assert.deepEqual(geoJson, expectedGeoJson);
|
assert.deepStrictEqual(geoJson, expectedGeoJson);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,12 +18,12 @@ describe('geopackage query', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.equal(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8');
|
||||||
assert.notEqual(res.headers['content-disposition'].indexOf(table_name + '.gpkg'), -1);
|
assert.notEqual(res.headers['content-disposition'].indexOf(table_name + '.gpkg'), -1);
|
||||||
var db = new sqlite.Database(':memory:', res.body);
|
var db = new sqlite.Database(':memory:', res.body);
|
||||||
var qr = db.get('PRAGMA database_list', function (err) {
|
var qr = db.get('PRAGMA database_list', function (err) {
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
assert.notEqual(qr, undefined);
|
assert.notEqual(qr, undefined);
|
||||||
@ -52,24 +52,24 @@ describe('geopackage query', function () {
|
|||||||
db.serialize(function () {
|
db.serialize(function () {
|
||||||
var schemaQuery = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name";
|
var schemaQuery = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name";
|
||||||
var sqr = db.get(schemaQuery, function (err, row) {
|
var sqr = db.get(schemaQuery, function (err, row) {
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, null);
|
||||||
assert.equal(row.name, table_name);
|
assert.strictEqual(row.name, table_name);
|
||||||
});
|
});
|
||||||
assert.notEqual(sqr, undefined);
|
assert.notEqual(sqr, undefined);
|
||||||
|
|
||||||
var gpkgQuery = 'SELECT table_name FROM gpkg_contents';
|
var gpkgQuery = 'SELECT table_name FROM gpkg_contents';
|
||||||
var gqr = db.get(gpkgQuery, function (err, row) {
|
var gqr = db.get(gpkgQuery, function (err, row) {
|
||||||
assert.equal(row.table_name, table_name);
|
assert.strictEqual(row.table_name, table_name);
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, null);
|
||||||
});
|
});
|
||||||
assert.notEqual(gqr, undefined);
|
assert.notEqual(gqr, undefined);
|
||||||
|
|
||||||
var dataQuery = 'SELECT * FROM ' + table_name + ' order by cartodb_id';
|
var dataQuery = 'SELECT * FROM ' + table_name + ' order by cartodb_id';
|
||||||
var dqr = db.get(dataQuery, function (err, row) {
|
var dqr = db.get(dataQuery, function (err, row) {
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, null);
|
||||||
assert.equal(row.cartodb_id, 1);
|
assert.strictEqual(row.cartodb_id, 1);
|
||||||
assert.equal(row.name, 'Hawai');
|
assert.strictEqual(row.name, 'Hawai');
|
||||||
assert.equal(row.fid, undefined);
|
assert.strictEqual(row.fid, undefined);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
assert.notEqual(dqr, undefined);
|
assert.notEqual(dqr, undefined);
|
||||||
|
@ -7,7 +7,7 @@ var assert = require('../../support/assert');
|
|||||||
var querystring = require('querystring');
|
var querystring = require('querystring');
|
||||||
var libxmljs = require('libxmljs');
|
var libxmljs = require('libxmljs');
|
||||||
|
|
||||||
describe('export.kml', function () {
|
describe.only('export.kml', function () {
|
||||||
// Check if an attribute is in the KML output
|
// Check if an attribute is in the KML output
|
||||||
//
|
//
|
||||||
// NOTE: "name" and "description" attributes are threated specially
|
// NOTE: "name" and "description" attributes are threated specially
|
||||||
@ -107,10 +107,11 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
var row0 = res.body;
|
var row0 = res.body;
|
||||||
var checkfields = { Name: 1, address: 1, cartodb_id: 1, the_geom: 0, the_geom_webmercator: 0 };
|
var checkfields = { Name: 1, address: 1, cartodb_id: 1, the_geom: 0, the_geom_webmercator: 0 };
|
||||||
Object.keys(checkfields).forEach(function (f) {
|
Object.keys(checkfields).forEach(function (f) {
|
||||||
@ -131,10 +132,11 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -149,10 +151,11 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
assert.ok(res.body.length > 81920, 'KML smaller than expected: ' + res.body.length);
|
assert.ok(res.body.length > 81920, 'KML smaller than expected: ' + res.body.length);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -164,10 +167,11 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
var row0 = res.body;
|
var row0 = res.body;
|
||||||
var checkFields = { Name: 1, address: 0, cartodb_id: 0, the_geom: 0, the_geom_webmercator: 0 };
|
var checkFields = { Name: 1, address: 0, cartodb_id: 0, the_geom: 0, the_geom_webmercator: 0 };
|
||||||
Object.keys(checkFields).forEach(function (f) {
|
Object.keys(checkFields).forEach(function (f) {
|
||||||
@ -187,12 +191,13 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=kmltest.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=kmltest.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
var name = extractFolderName(res.body);
|
var name = extractFolderName(res.body);
|
||||||
assert.equal(name, 'kmltest');
|
assert.strictEqual(name, 'kmltest');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -203,9 +208,10 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -222,14 +228,14 @@ describe('export.kml', function () {
|
|||||||
var waiting = concurrency;
|
var waiting = concurrency;
|
||||||
|
|
||||||
function validate (err, res) {
|
function validate (err, res) {
|
||||||
// console.log("Response ended");
|
assert.ifError(err);
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.ok(res.body);
|
assert.ok(res.body);
|
||||||
var snippet = res.body.substr(0, 5);
|
var snippet = res.body.substr(0, 5);
|
||||||
assert.equal(snippet, '<?xml');
|
assert.strictEqual(snippet, '<?xml');
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=multi.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
assert.strictEqual(true, /filename=multi.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||||
if (!--waiting) {
|
if (!--waiting) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
@ -242,7 +248,6 @@ describe('export.kml', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (var i = 0; i < concurrency; ++i) {
|
for (var i = 0; i < concurrency; ++i) {
|
||||||
// console.log("Sending request");
|
|
||||||
assert.response(server, request, { status: 200 }, validate);
|
assert.response(server, request, { status: 200 }, validate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -254,7 +259,8 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
// NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
|
// NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
|
||||||
var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?>' +
|
var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?>' +
|
||||||
'<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
'<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
||||||
@ -277,7 +283,8 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
// NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
|
// NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
|
||||||
var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?>' +
|
var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?>' +
|
||||||
'<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
'<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
||||||
@ -300,10 +307,11 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var coords = extractCoordinates(res.body);
|
var coords = extractCoordinates(res.body);
|
||||||
assert(coords, 'No coordinates in ' + res.body);
|
assert(coords, 'No coordinates in ' + res.body);
|
||||||
assert.deepEqual(coords, [[33, 16]]);
|
assert.deepStrictEqual(coords, [['33', '16']]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -319,10 +327,11 @@ describe('export.kml', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var coords = extractCoordinates(res.body);
|
var coords = extractCoordinates(res.body);
|
||||||
assert(coords, 'No coordinates in ' + res.body);
|
assert(coords, 'No coordinates in ' + res.body);
|
||||||
assert.deepEqual(coords, [[33, 16]]);
|
assert.deepStrictEqual(coords, [['33', '16']]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -343,7 +352,8 @@ describe('export.kml', function () {
|
|||||||
status: 200
|
status: 200
|
||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.body.match(/<Placemark>/g).length, limit);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.body.match(/<Placemark>/g).length, limit);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -363,7 +373,8 @@ describe('export.kml', function () {
|
|||||||
status: 200
|
status: 200
|
||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.body.match(/<Placemark>/g).length, limit);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.body.match(/<Placemark>/g).length, limit);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -387,7 +398,8 @@ describe('export.kml', function () {
|
|||||||
status: 200
|
status: 200
|
||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.body.match(/<Placemark>/g), null);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(res.body.match(/<Placemark>/g), null);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -20,10 +20,10 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.zip/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd));
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -47,10 +47,10 @@ describe('export.shapefile', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -65,10 +65,10 @@ describe('export.shapefile', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd);
|
assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd);
|
||||||
assert.ok(res.body.length > 81920, 'SHP smaller than expected: ' + res.body.length);
|
assert.ok(res.body.length > 81920, 'SHP smaller than expected: ' + res.body.length);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -81,10 +81,10 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=myshape.zip/gi.test(cd));
|
assert.strictEqual(true, /filename=myshape.zip/gi.test(cd));
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -107,11 +107,11 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var fname = 'b_______a';
|
var fname = 'b_______a';
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=b_______a.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd);
|
assert.strictEqual(true, /filename=b_______a.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd);
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -134,9 +134,9 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /filename=cartodb-query.zip/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd));
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -166,7 +166,7 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -193,9 +193,9 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
var error = parsedBody.error[0];
|
var error = parsedBody.error[0];
|
||||||
var expectedError = /Attempt to write non-point \(LINESTRING\) geometry to point shapefile/g;
|
var expectedError = /Attempt to write non-point \(LINESTRING\) geometry to point shapefile/g;
|
||||||
@ -219,9 +219,9 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
var error = parsedBody.error[0];
|
var error = parsedBody.error[0];
|
||||||
var expectedError = /Attempt to write non-point \(LINESTRING\) geometry to point shapefile/g;
|
var expectedError = /Attempt to write non-point \(LINESTRING\) geometry to point shapefile/g;
|
||||||
@ -243,7 +243,7 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -263,8 +263,8 @@ describe('export.shapefile', function () {
|
|||||||
var waiting = concurrency;
|
var waiting = concurrency;
|
||||||
function validate (err, res) {
|
function validate (err, res) {
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.zip/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd));
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -310,9 +310,9 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /filename=cartodb-query.zip/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd));
|
||||||
var tmpfile = '/tmp/myshape.zip';
|
var tmpfile = '/tmp/myshape.zip';
|
||||||
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary');
|
||||||
if (writeErr) {
|
if (writeErr) {
|
||||||
@ -371,7 +371,7 @@ describe('export.shapefile', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.equal(collection.features.length, limit);
|
assert.strictEqual(collection.features.length, limit);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -391,10 +391,10 @@ describe('export.shapefile', function () {
|
|||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.body);
|
assert.strictEqual(res.statusCode, 400, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
var respBodyPattern = new RegExp('Error executing zip command, {2}Error: spawn(.*)ENOENT', 'i');
|
var respBodyPattern = new RegExp('Error executing zip command, {2}Error: spawn(.*)ENOENT', 'i');
|
||||||
assert.equal(respBodyPattern.test(parsedBody.error[0]), true);
|
assert.strictEqual(respBodyPattern.test(parsedBody.error[0]), true);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -13,11 +13,11 @@ describe('spatialite query', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
assert.equal(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8');
|
||||||
var db = new sqlite.Database(':memory:', res.body);
|
var db = new sqlite.Database(':memory:', res.body);
|
||||||
var qr = db.get('PRAGMA database_list', function (err) {
|
var qr = db.get('PRAGMA database_list', function (err) {
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
assert.notEqual(qr, undefined);
|
assert.notEqual(qr, undefined);
|
||||||
@ -30,7 +30,7 @@ describe('spatialite query', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8');
|
||||||
assert.notEqual(res.headers['content-disposition'].indexOf('manolo.sqlite'), -1);
|
assert.notEqual(res.headers['content-disposition'].indexOf('manolo.sqlite'), -1);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -45,7 +45,7 @@ describe('spatialite query', function () {
|
|||||||
var db = new sqlite.Database(':memory:', res.body);
|
var db = new sqlite.Database(':memory:', res.body);
|
||||||
var schemaQuery = "SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name";
|
var schemaQuery = "SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name";
|
||||||
var qr = db.get(schemaQuery, function (err) {
|
var qr = db.get(schemaQuery, function (err) {
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
assert.notEqual(qr, undefined);
|
assert.notEqual(qr, undefined);
|
||||||
|
@ -17,10 +17,10 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
||||||
assert.equal(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
||||||
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0" />') > 0, res.body);
|
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0" />') > 0, res.body);
|
||||||
// TODO: test viewBox
|
// TODO: test viewBox
|
||||||
done();
|
done();
|
||||||
@ -38,11 +38,11 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SVG is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SVG is not disposed as attachment: ' + cd);
|
||||||
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
||||||
assert.equal(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
||||||
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0" />') > 0, res.body);
|
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0" />') > 0, res.body);
|
||||||
// TODO: test viewBox
|
// TODO: test viewBox
|
||||||
done();
|
done();
|
||||||
@ -60,10 +60,10 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.ok(/filename=mysvg.svg/gi.test(cd), cd);
|
assert.ok(/filename=mysvg.svg/gi.test(cd), cd);
|
||||||
assert.equal(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
||||||
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0" />') > 0, res.body);
|
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0" />') > 0, res.body);
|
||||||
// TODO: test viewBox
|
// TODO: test viewBox
|
||||||
done();
|
done();
|
||||||
@ -80,10 +80,10 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
||||||
assert.equal(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
||||||
assert.ok(res.body.indexOf('cx="0" cy="0"') > 0, res.body);
|
assert.ok(res.body.indexOf('cx="0" cy="0"') > 0, res.body);
|
||||||
// TODO: test viewBox
|
// TODO: test viewBox
|
||||||
// TODO: test radius
|
// TODO: test radius
|
||||||
@ -102,10 +102,10 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
||||||
assert.equal(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
||||||
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0 500.12 167.01" />') > 0, res.body);
|
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0 500.12 167.01" />') > 0, res.body);
|
||||||
// TODO: test viewBox
|
// TODO: test viewBox
|
||||||
|
|
||||||
@ -115,11 +115,11 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'SVG is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'SVG is not disposed as attachment: ' + cd);
|
||||||
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
assert.ok(/filename=cartodb-query.svg/gi.test(cd), cd);
|
||||||
assert.equal(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
assert.strictEqual(res.headers['content-type'], 'image/svg+xml; charset=utf-8');
|
||||||
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0 500.123 167.012" />') > 0, res.body);
|
assert.ok(res.body.indexOf('<path d="M 0 768 L 1024 0 500.123 167.012" />') > 0, res.body);
|
||||||
// TODO: test viewBox
|
// TODO: test viewBox
|
||||||
done();
|
done();
|
||||||
@ -140,10 +140,10 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
assert.deepEqual(res.headers['content-disposition'], 'inline');
|
assert.deepStrictEqual(res.headers['content-disposition'], 'inline');
|
||||||
assert.deepEqual(JSON.parse(res.body), {
|
assert.deepStrictEqual(JSON.parse(res.body), {
|
||||||
error: ['column "the_geom" does not exist']
|
error: ['column "the_geom" does not exist']
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
@ -160,8 +160,8 @@ describe('export.svg', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body);
|
||||||
assert.deepEqual(JSON.parse(res.body), {
|
assert.deepStrictEqual(JSON.parse(res.body), {
|
||||||
error: ['column "the_geom" does not exist']
|
error: ['column "the_geom" does not exist']
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
@ -186,8 +186,8 @@ describe('export.svg', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.deepEqual(Object.keys(parsedBody), ['error']);
|
assert.deepStrictEqual(Object.keys(parsedBody), ['error']);
|
||||||
assert.deepEqual(parsedBody.error, ['division by zero']);
|
assert.deepStrictEqual(parsedBody.error, ['division by zero']);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -102,7 +102,7 @@ describe('timeout', function () {
|
|||||||
this.testClient.getResult(scenario.query, override, (err, res) => {
|
this.testClient.getResult(scenario.query, override, (err, res) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|
||||||
assert.deepEqual(res, {
|
assert.deepStrictEqual(res, {
|
||||||
error: [
|
error: [
|
||||||
'You are over platform\'s limits: SQL query timeout error.' +
|
'You are over platform\'s limits: SQL query timeout error.' +
|
||||||
' Refactor your query before running again or contact CARTO support for more details.'
|
' Refactor your query before running again or contact CARTO support for more details.'
|
||||||
@ -185,7 +185,7 @@ describe('timeout', function () {
|
|||||||
this.testClient.getResult(scenario.query, override, (err, res) => {
|
this.testClient.getResult(scenario.query, override, (err, res) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|
||||||
assert.deepEqual(res, {
|
assert.deepStrictEqual(res, {
|
||||||
error: [
|
error: [
|
||||||
'You are over platform\'s limits: SQL query timeout error.' +
|
'You are over platform\'s limits: SQL query timeout error.' +
|
||||||
' Refactor your query before running again or contact CARTO support for more details.'
|
' Refactor your query before running again or contact CARTO support for more details.'
|
||||||
|
@ -37,25 +37,25 @@ describe('export.topojson', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.topojson/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.topojson/gi.test(cd));
|
||||||
var topojson = JSON.parse(res.body);
|
var topojson = JSON.parse(res.body);
|
||||||
assert.equal(topojson.type, 'Topology');
|
assert.strictEqual(topojson.type, 'Topology');
|
||||||
|
|
||||||
// Check transform
|
// Check transform
|
||||||
assert.ok(topojson.hasOwnProperty('transform'));
|
assert.ok(topojson.hasOwnProperty('transform'));
|
||||||
var trans = topojson.transform;
|
var trans = topojson.transform;
|
||||||
assert.equal(_.keys(trans).length, 2); // only scale and translate
|
assert.strictEqual(_.keys(trans).length, 2); // only scale and translate
|
||||||
assert.equal(trans.scale.length, 2); // scalex, scaley
|
assert.strictEqual(trans.scale.length, 2); // scalex, scaley
|
||||||
assert.equal(Math.round(trans.scale[0] * 1e6), 1000);
|
assert.strictEqual(Math.round(trans.scale[0] * 1e6), 1000);
|
||||||
assert.equal(Math.round(trans.scale[1] * 1e6), 1000);
|
assert.strictEqual(Math.round(trans.scale[1] * 1e6), 1000);
|
||||||
assert.equal(trans.translate.length, 2); // translatex, translatey
|
assert.strictEqual(trans.translate.length, 2); // translatex, translatey
|
||||||
assert.equal(trans.translate[0], -5);
|
assert.strictEqual(trans.translate[0], -5);
|
||||||
assert.equal(trans.translate[1], -5);
|
assert.strictEqual(trans.translate[1], -5);
|
||||||
|
|
||||||
// Check objects
|
// Check objects
|
||||||
assert.ok(topojson.hasOwnProperty('objects'));
|
assert.ok(topojson.hasOwnProperty('objects'));
|
||||||
assert.equal(_.keys(topojson.objects).length, 2);
|
assert.strictEqual(_.keys(topojson.objects).length, 2);
|
||||||
|
|
||||||
var obj = topojson.objects[0];
|
var obj = topojson.objects[0];
|
||||||
// console.dir(obj);
|
// console.dir(obj);
|
||||||
@ -63,17 +63,17 @@ describe('export.topojson', function () {
|
|||||||
// { type: 'Polygon',
|
// { type: 'Polygon',
|
||||||
// arcs: [ [ 0, 1 ] ],
|
// arcs: [ [ 0, 1 ] ],
|
||||||
// properties: { gid: 1, nam: 'U' } }
|
// properties: { gid: 1, nam: 'U' } }
|
||||||
assert.equal(_.keys(obj).length, 3); // type, arcs, properties
|
assert.strictEqual(_.keys(obj).length, 3); // type, arcs, properties
|
||||||
assert.equal(obj.type, 'Polygon');
|
assert.strictEqual(obj.type, 'Polygon');
|
||||||
assert.equal(obj.arcs.length, 1); /* only shell, no holes */
|
assert.strictEqual(obj.arcs.length, 1); /* only shell, no holes */
|
||||||
var shell = obj.arcs[0];
|
var shell = obj.arcs[0];
|
||||||
assert.equal(shell.length, 2); /* one shared arc, one non-shared */
|
assert.strictEqual(shell.length, 2); /* one shared arc, one non-shared */
|
||||||
assert.equal(shell[0], 0); /* shared arc */
|
assert.strictEqual(shell[0], 0); /* shared arc */
|
||||||
assert.equal(shell[1], 1); /* non-shared arc */
|
assert.strictEqual(shell[1], 1); /* non-shared arc */
|
||||||
var props = obj.properties;
|
var props = obj.properties;
|
||||||
assert.equal(_.keys(props).length, 2); // gid, name
|
assert.strictEqual(_.keys(props).length, 2); // gid, name
|
||||||
assert.equal(props.gid, 1);
|
assert.strictEqual(props.gid, 1);
|
||||||
assert.equal(props.name, 'U');
|
assert.strictEqual(props.name, 'U');
|
||||||
|
|
||||||
obj = topojson.objects[1];
|
obj = topojson.objects[1];
|
||||||
// console.dir(obj);
|
// console.dir(obj);
|
||||||
@ -81,51 +81,51 @@ describe('export.topojson', function () {
|
|||||||
// { type: 'Polygon',
|
// { type: 'Polygon',
|
||||||
// arcs: [ [ 0, 2 ] ],
|
// arcs: [ [ 0, 2 ] ],
|
||||||
// properties: { gid: 2, nam: 'D' } }
|
// properties: { gid: 2, nam: 'D' } }
|
||||||
assert.equal(_.keys(obj).length, 3); // type, arcs, properties
|
assert.strictEqual(_.keys(obj).length, 3); // type, arcs, properties
|
||||||
assert.equal(obj.type, 'Polygon');
|
assert.strictEqual(obj.type, 'Polygon');
|
||||||
assert.equal(obj.arcs.length, 1); /* only shell, no holes */
|
assert.strictEqual(obj.arcs.length, 1); /* only shell, no holes */
|
||||||
shell = obj.arcs[0];
|
shell = obj.arcs[0];
|
||||||
assert.equal(shell.length, 2); /* one shared arc, one non-shared */
|
assert.strictEqual(shell.length, 2); /* one shared arc, one non-shared */
|
||||||
assert.equal(shell[0], 0); /* shared arc */
|
assert.strictEqual(shell[0], 0); /* shared arc */
|
||||||
assert.equal(shell[1], 2); /* non-shared arc */
|
assert.strictEqual(shell[1], 2); /* non-shared arc */
|
||||||
props = obj.properties;
|
props = obj.properties;
|
||||||
assert.equal(_.keys(props).length, 2); // gid, name
|
assert.strictEqual(_.keys(props).length, 2); // gid, name
|
||||||
assert.equal(props.gid, 2);
|
assert.strictEqual(props.gid, 2);
|
||||||
assert.equal(props.name, 'D');
|
assert.strictEqual(props.name, 'D');
|
||||||
|
|
||||||
// Check arcs
|
// Check arcs
|
||||||
assert.ok(topojson.hasOwnProperty('arcs'));
|
assert.ok(topojson.hasOwnProperty('arcs'));
|
||||||
assert.equal(topojson.arcs.length, 3); // one shared, two non-shared
|
assert.strictEqual(topojson.arcs.length, 3); // one shared, two non-shared
|
||||||
var arc = topojson.arcs[0]; // shared arc
|
var arc = topojson.arcs[0]; // shared arc
|
||||||
assert.equal(arc.length, 2); // shared arc has two vertices
|
assert.strictEqual(arc.length, 2); // shared arc has two vertices
|
||||||
var p = arc[0];
|
var p = arc[0];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), 0);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), 0);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), 5);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), 5);
|
||||||
p = arc[1];
|
p = arc[1];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), 5);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), 5);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), 5);
|
||||||
arc = topojson.arcs[1]; // non shared arc
|
arc = topojson.arcs[1]; // non shared arc
|
||||||
assert.equal(arc.length, 3); // non shared arcs have three vertices
|
assert.strictEqual(arc.length, 3); // non shared arcs have three vertices
|
||||||
p = arc[0];
|
p = arc[0];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), 5);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), 10);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), 10);
|
||||||
p = arc[1];
|
p = arc[1];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), 5);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), -5);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), -5);
|
||||||
p = arc[2];
|
p = arc[2];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), -10);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), -10);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), 0);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), 0);
|
||||||
arc = topojson.arcs[2]; // non shared arc
|
arc = topojson.arcs[2]; // non shared arc
|
||||||
assert.equal(arc.length, 3); // non shared arcs have three vertices
|
assert.strictEqual(arc.length, 3); // non shared arcs have three vertices
|
||||||
p = arc[0];
|
p = arc[0];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), 5);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), 10);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), 10);
|
||||||
p = arc[1];
|
p = arc[1];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), 0);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), 0);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), -10);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), -10);
|
||||||
p = arc[2];
|
p = arc[2];
|
||||||
assert.equal(Math.round(p[0] * trans.scale[0]), -5);
|
assert.strictEqual(Math.round(p[0] * trans.scale[0]), -5);
|
||||||
assert.equal(Math.round(p[1] * trans.scale[1]), 5);
|
assert.strictEqual(Math.round(p[1] * trans.scale[1]), 5);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -142,25 +142,25 @@ describe('export.topojson', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var cd = res.headers['content-disposition'];
|
var cd = res.headers['content-disposition'];
|
||||||
assert.equal(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd);
|
assert.strictEqual(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd);
|
||||||
assert.equal(true, /filename=cartodb-query.topojson/gi.test(cd));
|
assert.strictEqual(true, /filename=cartodb-query.topojson/gi.test(cd));
|
||||||
var topojson = JSON.parse(res.body);
|
var topojson = JSON.parse(res.body);
|
||||||
assert.equal(topojson.type, 'Topology');
|
assert.strictEqual(topojson.type, 'Topology');
|
||||||
|
|
||||||
// Check transform
|
// Check transform
|
||||||
assert.ok(topojson.hasOwnProperty('transform'));
|
assert.ok(topojson.hasOwnProperty('transform'));
|
||||||
var trans = topojson.transform;
|
var trans = topojson.transform;
|
||||||
assert.equal(_.keys(trans).length, 2); // only scale and translate
|
assert.strictEqual(_.keys(trans).length, 2); // only scale and translate
|
||||||
assert.equal(trans.scale.length, 2); // scalex, scaley
|
assert.strictEqual(trans.scale.length, 2); // scalex, scaley
|
||||||
assert.equal(Math.round(trans.scale[0] * 1e6), 1000);
|
assert.strictEqual(Math.round(trans.scale[0] * 1e6), 1000);
|
||||||
assert.equal(Math.round(trans.scale[1] * 1e6), 500);
|
assert.strictEqual(Math.round(trans.scale[1] * 1e6), 500);
|
||||||
assert.equal(trans.translate.length, 2); // translatex, translatey
|
assert.strictEqual(trans.translate.length, 2); // translatex, translatey
|
||||||
assert.equal(trans.translate[0], -5);
|
assert.strictEqual(trans.translate[0], -5);
|
||||||
assert.equal(trans.translate[1], 0);
|
assert.strictEqual(trans.translate[1], 0);
|
||||||
|
|
||||||
// Check objects
|
// Check objects
|
||||||
assert.ok(topojson.hasOwnProperty('objects'));
|
assert.ok(topojson.hasOwnProperty('objects'));
|
||||||
assert.equal(_.keys(topojson.objects).length, 1);
|
assert.strictEqual(_.keys(topojson.objects).length, 1);
|
||||||
|
|
||||||
var obj = topojson.objects[0];
|
var obj = topojson.objects[0];
|
||||||
// console.dir(obj);
|
// console.dir(obj);
|
||||||
@ -168,22 +168,22 @@ describe('export.topojson', function () {
|
|||||||
// { type: 'Polygon',
|
// { type: 'Polygon',
|
||||||
// arcs: [ [ 0, 1 ] ],
|
// arcs: [ [ 0, 1 ] ],
|
||||||
// properties: { gid: 1, nam: 'U' } }
|
// properties: { gid: 1, nam: 'U' } }
|
||||||
assert.equal(_.keys(obj).length, 3); // type, arcs, properties
|
assert.strictEqual(_.keys(obj).length, 3); // type, arcs, properties
|
||||||
assert.equal(obj.type, 'Polygon');
|
assert.strictEqual(obj.type, 'Polygon');
|
||||||
assert.equal(obj.arcs.length, 1); /* only shell, no holes */
|
assert.strictEqual(obj.arcs.length, 1); /* only shell, no holes */
|
||||||
var shell = obj.arcs[0];
|
var shell = obj.arcs[0];
|
||||||
assert.equal(shell.length, 1); /* one non shared arc */
|
assert.strictEqual(shell.length, 1); /* one non shared arc */
|
||||||
assert.equal(shell[0], 0); /* non-shared arc */
|
assert.strictEqual(shell[0], 0); /* non-shared arc */
|
||||||
var props = obj.properties;
|
var props = obj.properties;
|
||||||
assert.equal(_.keys(props).length, 2); // gid, name
|
assert.strictEqual(_.keys(props).length, 2); // gid, name
|
||||||
assert.equal(props.gid, 1);
|
assert.strictEqual(props.gid, 1);
|
||||||
assert.equal(props.name, 'U');
|
assert.strictEqual(props.name, 'U');
|
||||||
|
|
||||||
// Check arcs
|
// Check arcs
|
||||||
assert.ok(topojson.hasOwnProperty('arcs'));
|
assert.ok(topojson.hasOwnProperty('arcs'));
|
||||||
assert.equal(topojson.arcs.length, 1);
|
assert.strictEqual(topojson.arcs.length, 1);
|
||||||
var arc = topojson.arcs[0];
|
var arc = topojson.arcs[0];
|
||||||
assert.deepEqual(arc, [[0, 0], [4999, 9999], [5000, -9999], [-9999, 0]]);
|
assert.deepStrictEqual(arc, [[0, 0], [4999, 9999], [5000, -9999], [-9999, 0]]);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -202,7 +202,7 @@ describe('export.topojson', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.objects[0].properties.gid, 1, 'gid was expected property');
|
assert.strictEqual(parsedBody.objects[0].properties.gid, 1, 'gid was expected property');
|
||||||
assert.ok(!parsedBody.objects[0].properties.name);
|
assert.ok(!parsedBody.objects[0].properties.name);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ describe('export.topojson', function () {
|
|||||||
status: 200
|
status: 200
|
||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
var didRunJsonCallback = false;
|
var didRunJsonCallback = false;
|
||||||
// jshint ignore:start
|
// jshint ignore:start
|
||||||
function foo_jsonp (body) {
|
function foo_jsonp (body) {
|
||||||
@ -254,8 +254,8 @@ describe('export.topojson', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.deepEqual(Object.keys(parsedBody), ['error']);
|
assert.deepStrictEqual(Object.keys(parsedBody), ['error']);
|
||||||
assert.deepEqual(parsedBody.error, ['division by zero']);
|
assert.deepStrictEqual(parsedBody.error, ['division by zero']);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -30,7 +30,7 @@ describe('Handle query middleware', function () {
|
|||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.deepEqual(response, { error: ['You must indicate a sql query'] });
|
assert.deepStrictEqual(response, { error: ['You must indicate a sql query'] });
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
@ -54,8 +54,8 @@ describe('Handle query middleware', function () {
|
|||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.equal(response.rows.length, 1);
|
assert.strictEqual(response.rows.length, 1);
|
||||||
assert.equal(response.rows[0].foo, 14);
|
assert.strictEqual(response.rows[0].foo, 14);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
@ -81,8 +81,8 @@ describe('Handle query middleware', function () {
|
|||||||
jobResult.getStatus(function (err, job) {
|
jobResult.getStatus(function (err, job) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.equal(job.query, QUERY);
|
assert.strictEqual(job.query, QUERY);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -97,8 +97,8 @@ describe('Handle query middleware', function () {
|
|||||||
jobResult.getStatus(function (err, job) {
|
jobResult.getStatus(function (err, job) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
|
||||||
assert.equal(job.status, JobStatus.DONE);
|
assert.strictEqual(job.status, JobStatus.DONE);
|
||||||
assert.deepEqual(job.query, [
|
assert.deepStrictEqual(job.query, [
|
||||||
{ query: QUERY, status: JobStatus.DONE },
|
{ query: QUERY, status: JobStatus.DONE },
|
||||||
{ query: QUERY, status: JobStatus.DONE }
|
{ query: QUERY, status: JobStatus.DONE }
|
||||||
]);
|
]);
|
||||||
|
@ -37,7 +37,7 @@ describe('health checks', function () {
|
|||||||
|
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
|
|
||||||
assert.equal(parsed.enabled, false);
|
assert.strictEqual(parsed.enabled, false);
|
||||||
assert.ok(parsed.ok);
|
assert.ok(parsed.ok);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -51,7 +51,7 @@ describe('last modified header', function () {
|
|||||||
statusCode: 200
|
statusCode: 200
|
||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.equal(res.headers['last-modified'], scenario.expectedLastModified);
|
assert.strictEqual(res.headers['last-modified'], scenario.expectedLastModified);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -78,7 +78,7 @@ describe('last modified header', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
MockDate.reset();
|
MockDate.reset();
|
||||||
assert.equal(res.headers['last-modified'], new Date(fixedDateNow).toUTCString());
|
assert.strictEqual(res.headers['last-modified'], new Date(fixedDateNow).toUTCString());
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -104,7 +104,7 @@ describe('last modified header', function () {
|
|||||||
},
|
},
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
MockDate.reset();
|
MockDate.reset();
|
||||||
assert.equal(res.headers['last-modified'], new Date(fixedDateNow).toUTCString());
|
assert.strictEqual(res.headers['last-modified'], new Date(fixedDateNow).toUTCString());
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -42,7 +42,7 @@ describe('Log middleware', function () {
|
|||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-log']);
|
assert.ok(res.headers['x-sqlapi-log']);
|
||||||
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
||||||
assert.deepEqual(log, {
|
assert.deepStrictEqual(log, {
|
||||||
request: {
|
request: {
|
||||||
sql: {
|
sql: {
|
||||||
type: TYPES.QUERY,
|
type: TYPES.QUERY,
|
||||||
@ -104,7 +104,7 @@ describe('Log middleware', function () {
|
|||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-log']);
|
assert.ok(res.headers['x-sqlapi-log']);
|
||||||
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
||||||
assert.deepEqual(log, {
|
assert.deepStrictEqual(log, {
|
||||||
request: {
|
request: {
|
||||||
sql: {
|
sql: {
|
||||||
type: TYPES.JOB,
|
type: TYPES.JOB,
|
||||||
@ -142,11 +142,14 @@ describe('Log middleware', function () {
|
|||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-log']);
|
assert.ok(res.headers['x-sqlapi-log']);
|
||||||
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
||||||
assert.deepEqual(log, {
|
assert.deepStrictEqual(log, {
|
||||||
request: {
|
request: {
|
||||||
sql: {
|
sql: {
|
||||||
type: TYPES.JOB,
|
type: TYPES.JOB,
|
||||||
sql: [QUERY, QUERY]
|
sql: {
|
||||||
|
0: QUERY,
|
||||||
|
1: QUERY
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -212,11 +215,21 @@ describe('Log middleware', function () {
|
|||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-log']);
|
assert.ok(res.headers['x-sqlapi-log']);
|
||||||
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
||||||
assert.deepEqual(log, {
|
assert.deepStrictEqual(log, {
|
||||||
request: {
|
request: {
|
||||||
sql: {
|
sql: {
|
||||||
type: TYPES.JOB,
|
type: TYPES.JOB,
|
||||||
sql: FALLBACK_QUERY
|
sql: {
|
||||||
|
onsuccess: QUERY,
|
||||||
|
onerror: QUERY,
|
||||||
|
query: {
|
||||||
|
0: {
|
||||||
|
query: QUERY,
|
||||||
|
onsuccess: QUERY,
|
||||||
|
onerror: QUERY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -253,7 +266,7 @@ describe('Log middleware', function () {
|
|||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-log']);
|
assert.ok(res.headers['x-sqlapi-log']);
|
||||||
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
const log = JSON.parse(res.headers['x-sqlapi-log']);
|
||||||
assert.deepEqual(log, {
|
assert.deepStrictEqual(log, {
|
||||||
request: {
|
request: {
|
||||||
sql: null
|
sql: null
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ describe('results-pagination', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4');
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.equal(parsed.rows.length, 1);
|
assert.strictEqual(parsed.rows.length, 1);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -83,11 +83,11 @@ describe('results-pagination', function () {
|
|||||||
}
|
}
|
||||||
assert.response(server, req, RESPONSE_OK, function (err, res) {
|
assert.response(server, req, RESPONSE_OK, function (err, res) {
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.equal(parsed.rows.length, nrows);
|
assert.strictEqual(parsed.rows.length, nrows);
|
||||||
for (var i = 0; i < nrows; ++i) {
|
for (var i = 0; i < nrows; ++i) {
|
||||||
var obt = parsed.rows[i].v;
|
var obt = parsed.rows[i].v;
|
||||||
var exp = page * nrows + i + 1;
|
var exp = page * nrows + i + 1;
|
||||||
assert.equal(obt, exp, 'Value ' + i + ' in page ' + page + ' is ' + obt + ', expected ' + exp);
|
assert.strictEqual(obt, exp, 'Value ' + i + ' in page ' + page + ' is ' + obt + ', expected ' + exp);
|
||||||
}
|
}
|
||||||
testNext();
|
testNext();
|
||||||
});
|
});
|
||||||
@ -111,11 +111,11 @@ describe('results-pagination', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var parsed = JSON.parse(res.body);
|
var parsed = JSON.parse(res.body);
|
||||||
assert.equal(parsed.rows.length, 3);
|
assert.strictEqual(parsed.rows.length, 3);
|
||||||
for (var i = 0; i < nrows; ++i) {
|
for (var i = 0; i < nrows; ++i) {
|
||||||
var obt = parsed.rows[i].v;
|
var obt = parsed.rows[i].v;
|
||||||
var exp = page * nrows + i + 1;
|
var exp = page * nrows + i + 1;
|
||||||
assert.equal(obt, exp, 'Value ' + i + ' in page ' + page + ' is ' + obt + ', expected ' + exp);
|
assert.strictEqual(obt, exp, 'Value ' + i + ' in page ' + page + ' is ' + obt + ', expected ' + exp);
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -155,7 +155,7 @@ describe('results-pagination', function () {
|
|||||||
function check_res_drop_table (err, res) {
|
function check_res_drop_table (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.equal(out.total_rows, 1); // windowing works
|
assert.strictEqual(out.total_rows, 1); // windowing works
|
||||||
var next = this;
|
var next = this;
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/api/v1/sql?' + querystring.stringify({
|
url: '/api/v1/sql?' + querystring.stringify({
|
||||||
|
@ -21,7 +21,7 @@ describe('PG entities access validator', function () {
|
|||||||
function assertQuery (query, testClient, done) {
|
function assertQuery (query, testClient, done) {
|
||||||
testClient.getResult(query, expectedResponse, (err, result) => {
|
testClient.getResult(query, expectedResponse, (err, result) => {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(result.error, 'system tables are forbidden');
|
assert.deepStrictEqual(result.error, ['system tables are forbidden']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ describe('PG field type information', function () {
|
|||||||
function (err, res) {
|
function (err, res) {
|
||||||
const body = JSON.parse(res.body);
|
const body = JSON.parse(res.body);
|
||||||
|
|
||||||
assert.deepEqual(body.fields, {
|
assert.deepStrictEqual(body.fields, {
|
||||||
geography_point_4326: {
|
geography_point_4326: {
|
||||||
type: 'geography', wkbtype: 'Point', dims: 2, srid: 4326
|
type: 'geography', wkbtype: 'Point', dims: 2, srid: 4326
|
||||||
},
|
},
|
||||||
|
@ -61,10 +61,10 @@ describe('special numeric (float) values', function () {
|
|||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
var result = JSON.parse(res.body);
|
var result = JSON.parse(res.body);
|
||||||
assert.ok(Array.isArray(result.rows));
|
assert.ok(Array.isArray(result.rows));
|
||||||
assert.equal(result.rows[0].val, 'NaN');
|
assert.strictEqual(result.rows[0].val, 'NaN');
|
||||||
assert.equal(result.rows[1].val, 'Infinity');
|
assert.strictEqual(result.rows[1].val, 'Infinity');
|
||||||
assert.equal(result.rows[2].val, '-Infinity');
|
assert.strictEqual(result.rows[2].val, '-Infinity');
|
||||||
assert.equal(result.rows[3].val, 1);
|
assert.strictEqual(result.rows[3].val, 1);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -17,7 +17,7 @@ describe('query-multipart', function () {
|
|||||||
}, {}, function (err, res) {
|
}, {}, function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.equal(typeof (response.time) !== 'undefined', true);
|
assert.strictEqual(typeof (response.time) !== 'undefined', true);
|
||||||
assert.strictEqual(response.total_rows, 1);
|
assert.strictEqual(response.total_rows, 1);
|
||||||
assert.deepStrictEqual(response.rows, [{ n: 2 }]);
|
assert.deepStrictEqual(response.rows, [{ n: 2 }]);
|
||||||
done();
|
done();
|
||||||
|
@ -29,12 +29,12 @@ describe('query-returning', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(out.hasOwnProperty('time'));
|
||||||
assert.equal(out.total_rows, 2);
|
assert.strictEqual(out.total_rows, 2);
|
||||||
assert.equal(out.rows.length, 0);
|
assert.strictEqual(out.rows.length, 0);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -54,12 +54,12 @@ describe('query-returning', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(out.hasOwnProperty('time'));
|
||||||
assert.equal(out.total_rows, 2);
|
assert.strictEqual(out.total_rows, 2);
|
||||||
assert.equal(out.rows.length, 0);
|
assert.strictEqual(out.rows.length, 0);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -79,12 +79,12 @@ describe('query-returning', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(out.hasOwnProperty('time'));
|
||||||
assert.equal(out.total_rows, 2);
|
assert.strictEqual(out.total_rows, 2);
|
||||||
assert.equal(out.rows.length, 0);
|
assert.strictEqual(out.rows.length, 0);
|
||||||
// Check cache headers
|
// Check cache headers
|
||||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43
|
||||||
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.hasOwnProperty('x-cache-channel'));
|
||||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -104,11 +104,11 @@ describe('query-returning', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(out.hasOwnProperty('time'));
|
||||||
assert.equal(out.total_rows, 1);
|
assert.strictEqual(out.total_rows, 1);
|
||||||
assert.equal(out.rows.length, 1);
|
assert.strictEqual(out.rows.length, 1);
|
||||||
assert.equal(_.keys(out.rows[0]).length, 2);
|
assert.strictEqual(_.keys(out.rows[0]).length, 2);
|
||||||
assert.equal(out.rows[0].upper, 'TEST');
|
assert.strictEqual(out.rows[0].upper, 'TEST');
|
||||||
assert.equal(out.rows[0].reverse, 'tset');
|
assert.strictEqual(out.rows[0].reverse, 'tset');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -128,11 +128,11 @@ describe('query-returning', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(out.hasOwnProperty('time'));
|
||||||
assert.equal(out.total_rows, 1);
|
assert.strictEqual(out.total_rows, 1);
|
||||||
assert.equal(out.rows.length, 1);
|
assert.strictEqual(out.rows.length, 1);
|
||||||
assert.equal(_.keys(out.rows[0]).length, 2);
|
assert.strictEqual(_.keys(out.rows[0]).length, 2);
|
||||||
assert.equal(out.rows[0].upper, 'TOST');
|
assert.strictEqual(out.rows[0].upper, 'TOST');
|
||||||
assert.equal(out.rows[0].reverse, 'tsot');
|
assert.strictEqual(out.rows[0].reverse, 'tsot');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -152,10 +152,10 @@ describe('query-returning', function () {
|
|||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var out = JSON.parse(res.body);
|
var out = JSON.parse(res.body);
|
||||||
assert.ok(out.hasOwnProperty('time'));
|
assert.ok(out.hasOwnProperty('time'));
|
||||||
assert.equal(out.total_rows, 1);
|
assert.strictEqual(out.total_rows, 1);
|
||||||
assert.equal(out.rows.length, 1);
|
assert.strictEqual(out.rows.length, 1);
|
||||||
assert.equal(_.keys(out.rows[0]).length, 1);
|
assert.strictEqual(_.keys(out.rows[0]).length, 1);
|
||||||
assert.equal(out.rows[0].name, 'tost');
|
assert.strictEqual(out.rows[0].name, 'tost');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -46,12 +46,12 @@ function assertRequest (status, limit, remaining, reset, retry, done = null) {
|
|||||||
{ status },
|
{ status },
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(res.headers['carto-rate-limit-limit'], limit);
|
assert.strictEqual(res.headers['carto-rate-limit-limit'], limit);
|
||||||
assert.equal(res.headers['carto-rate-limit-remaining'], remaining);
|
assert.strictEqual(res.headers['carto-rate-limit-remaining'], remaining);
|
||||||
assert.equal(res.headers['carto-rate-limit-reset'], reset);
|
assert.strictEqual(res.headers['carto-rate-limit-reset'], reset);
|
||||||
|
|
||||||
if (retry) {
|
if (retry) {
|
||||||
assert.equal(res.headers['retry-after'], retry);
|
assert.strictEqual(res.headers['retry-after'], retry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status === 429) {
|
if (status === 429) {
|
||||||
@ -61,7 +61,7 @@ function assertRequest (status, limit, remaining, reset, retry, done = null) {
|
|||||||
detail: 'rate-limit'
|
detail: 'rate-limit'
|
||||||
};
|
};
|
||||||
|
|
||||||
assert.deepEqual(JSON.parse(res.body), expectedResponse);
|
assert.deepStrictEqual(JSON.parse(res.body), expectedResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
@ -95,11 +95,11 @@ describe('rate limit', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('1 req/sec: 2 req/seg should be limited', function (done) {
|
it('1 req/sec: 2 req/seg should be limited', function (done) {
|
||||||
assertRequest(200, 2, 1, 1);
|
assertRequest(200, '2', '1', '1');
|
||||||
setTimeout(() => assertRequest(200, 2, 0, 1, null), 250);
|
setTimeout(() => assertRequest(200, '2', '0', '1', null), 250);
|
||||||
setTimeout(() => assertRequest(429, 2, 0, 1, 1), 500);
|
setTimeout(() => assertRequest(429, '2', '0', '1', '1'), 500);
|
||||||
setTimeout(() => assertRequest(429, 2, 0, 1, 1), 750);
|
setTimeout(() => assertRequest(429, '2', '0', '1', '1'), 750);
|
||||||
setTimeout(() => assertRequest(429, 2, 0, 1, 1), 950);
|
setTimeout(() => assertRequest(429, '2', '0', '1', '1'), 950);
|
||||||
setTimeout(() => assertRequest(200, 2, 0, 1, null, done), 1050);
|
setTimeout(() => assertRequest(200, '2', '0', '1', null, done), 1050);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -37,7 +37,7 @@ describe('regressions', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.total_rows, 2);
|
assert.strictEqual(parsedBody.total_rows, 2);
|
||||||
|
|
||||||
assert.response(server, createRequest('SELECT * FROM "foo.bar"'), responseOk,
|
assert.response(server, createRequest('SELECT * FROM "foo.bar"'), responseOk,
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
@ -48,8 +48,8 @@ describe('regressions', function () {
|
|||||||
// table should not get a cache channel as it won't get invalidated
|
// table should not get a cache channel as it won't get invalidated
|
||||||
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
|
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.total_rows, 2);
|
assert.strictEqual(parsedBody.total_rows, 2);
|
||||||
assert.deepEqual(parsedBody.rows, [{ a: 1 }, { a: 2 }]);
|
assert.deepStrictEqual(parsedBody.rows, [{ a: 1 }, { a: 2 }]);
|
||||||
|
|
||||||
// delete table
|
// delete table
|
||||||
assert.response(server, createRequest('DROP TABLE "foo.bar"'), responseOk, done);
|
assert.response(server, createRequest('DROP TABLE "foo.bar"'), responseOk, done);
|
||||||
|
@ -63,7 +63,7 @@ describe('skipfields', function () {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, RESPONSE_OK, function (err, res) {
|
}, RESPONSE_OK, function (err, res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(_.keys(parsedBody.fields).length, 2);
|
assert.strictEqual(_.keys(parsedBody.fields).length, 2);
|
||||||
assert.ok(parsedBody.fields.hasOwnProperty('a'));
|
assert.ok(parsedBody.fields.hasOwnProperty('a'));
|
||||||
assert.ok(!parsedBody.fields.hasOwnProperty('b'));
|
assert.ok(!parsedBody.fields.hasOwnProperty('b'));
|
||||||
assert.ok(parsedBody.fields.hasOwnProperty('c'));
|
assert.ok(parsedBody.fields.hasOwnProperty('c'));
|
||||||
@ -76,7 +76,7 @@ describe('skipfields', function () {
|
|||||||
headers: { host: 'vizzuality.cartodb.com' },
|
headers: { host: 'vizzuality.cartodb.com' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, { }, function (err, res) {
|
}, { }, function (err, res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.strictEqual(res.statusCode, 200, res.body);
|
||||||
var row0 = JSON.parse(res.body).rows[0];
|
var row0 = JSON.parse(res.body).rows[0];
|
||||||
var checkfields = { name: 1, cartodb_id: 1, the_geom: 1, the_geom_webmercator: 1 };
|
var checkfields = { name: 1, cartodb_id: 1, the_geom: 1, the_geom_webmercator: 1 };
|
||||||
for (var f in checkfields) {
|
for (var f in checkfields) {
|
||||||
|
@ -37,8 +37,8 @@ describe('stream-responses', function () {
|
|||||||
okResponse,
|
okResponse,
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.rows.length, 2);
|
assert.strictEqual(parsedBody.rows.length, 2);
|
||||||
assert.deepEqual(parsedBody.error, ['division by zero']);
|
assert.deepStrictEqual(parsedBody.error, ['division by zero']);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -53,8 +53,8 @@ describe('stream-responses', function () {
|
|||||||
okResponse,
|
okResponse,
|
||||||
function (err, res) {
|
function (err, res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(parsedBody.features.length, 2);
|
assert.strictEqual(parsedBody.features.length, 2);
|
||||||
assert.deepEqual(parsedBody.error, ['division by zero']);
|
assert.deepStrictEqual(parsedBody.error, ['division by zero']);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -32,10 +32,10 @@ describe('Surrogate-Key header', function () {
|
|||||||
|
|
||||||
var expectedSurrogateKeys = new QueryTables.QueryMetadata(expectedTables).key();
|
var expectedSurrogateKeys = new QueryTables.QueryMetadata(expectedTables).key();
|
||||||
|
|
||||||
assert.equal(surrogateKeys.length, expectedSurrogateKeys.length);
|
assert.strictEqual(surrogateKeys.length, expectedSurrogateKeys.length);
|
||||||
|
|
||||||
var tablesDiff = _.difference(surrogateKeys, expectedSurrogateKeys);
|
var tablesDiff = _.difference(surrogateKeys, expectedSurrogateKeys);
|
||||||
assert.equal(tablesDiff.length, 0, 'Surrogate-Key missing tables: ' + tablesDiff.join(','));
|
assert.strictEqual(tablesDiff.length, 0, 'Surrogate-Key missing tables: ' + tablesDiff.join(','));
|
||||||
}
|
}
|
||||||
|
|
||||||
function tableNamesInSurrogateKeyHeader (expectedTableNames, done) {
|
function tableNamesInSurrogateKeyHeader (expectedTableNames, done) {
|
||||||
|
@ -52,7 +52,7 @@ describe('system-queries', function () {
|
|||||||
url: '/api/v1/sql?' + querystring.stringify(queryStringParams)
|
url: '/api/v1/sql?' + querystring.stringify(queryStringParams)
|
||||||
};
|
};
|
||||||
assert.response(server, request, function (err, response) {
|
assert.response(server, request, function (err, response) {
|
||||||
assert.equal(response.statusCode, statusErrorCode);
|
assert.strictEqual(response.statusCode, statusErrorCode);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -33,19 +33,19 @@ describe('transaction', function () {
|
|||||||
it('should NOT fail to second request after error in transaction', function (done) {
|
it('should NOT fail to second request after error in transaction', function (done) {
|
||||||
sqlRequest(requestUrl(errorQuery), function (err, response, body) {
|
sqlRequest(requestUrl(errorQuery), function (err, response, body) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
assert.equal(response.statusCode, 400);
|
assert.strictEqual(response.statusCode, 400);
|
||||||
|
|
||||||
var parsedBody = JSON.parse(body);
|
var parsedBody = JSON.parse(body);
|
||||||
assert.ok(parsedBody);
|
assert.ok(parsedBody);
|
||||||
assert.deepEqual(parsedBody, { error: ['column "error" does not exist'] });
|
assert.deepStrictEqual(parsedBody, { error: ['column "error" does not exist'] });
|
||||||
|
|
||||||
sqlRequest(requestUrl('select 1 as foo'), function (err, response, body) {
|
sqlRequest(requestUrl('select 1 as foo'), function (err, response, body) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
assert.equal(response.statusCode, 200);
|
assert.strictEqual(response.statusCode, 200);
|
||||||
|
|
||||||
var parsedBody = JSON.parse(body);
|
var parsedBody = JSON.parse(body);
|
||||||
assert.ok(parsedBody);
|
assert.ok(parsedBody);
|
||||||
assert.deepEqual(parsedBody.rows, [{ foo: 1 }]);
|
assert.deepStrictEqual(parsedBody.rows, [{ foo: 1 }]);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -30,13 +30,13 @@ describe('X-Cache-Channel header', function () {
|
|||||||
var databaseAndTables = xCacheChannel.split(':');
|
var databaseAndTables = xCacheChannel.split(':');
|
||||||
var databaseName = databaseAndTables[0];
|
var databaseName = databaseAndTables[0];
|
||||||
|
|
||||||
assert.equal(databaseName, 'cartodb_test_user_1_db');
|
assert.strictEqual(databaseName, 'cartodb_test_user_1_db');
|
||||||
|
|
||||||
var headerTableNames = databaseAndTables[1].split(',');
|
var headerTableNames = databaseAndTables[1].split(',');
|
||||||
assert.equal(headerTableNames.length, expectedTablesNames.length);
|
assert.strictEqual(headerTableNames.length, expectedTablesNames.length);
|
||||||
|
|
||||||
var tablesDiff = _.difference(expectedTablesNames, headerTableNames);
|
var tablesDiff = _.difference(expectedTablesNames, headerTableNames);
|
||||||
assert.equal(tablesDiff.length, 0, 'X-Cache-Channel header missing tables: ' + tablesDiff.join(','));
|
assert.strictEqual(tablesDiff.length, 0, 'X-Cache-Channel header missing tables: ' + tablesDiff.join(','));
|
||||||
}
|
}
|
||||||
|
|
||||||
function tableNamesInCacheChannelHeader (expectedTableNames, done) {
|
function tableNamesInCacheChannelHeader (expectedTableNames, done) {
|
||||||
|
@ -50,7 +50,7 @@ describe('job backend', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(jobCreated.job_id);
|
assert.ok(jobCreated.job_id);
|
||||||
assert.equal(jobCreated.status, jobStatus.PENDING);
|
assert.strictEqual(jobCreated.status, jobStatus.PENDING);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -62,8 +62,8 @@ describe('job backend', function () {
|
|||||||
|
|
||||||
jobBackend.create(job.data, function (err) {
|
jobBackend.create(job.data, function (err) {
|
||||||
assert.ok(err);
|
assert.ok(err);
|
||||||
assert.equal(err.name, 'NotFoundError');
|
assert.strictEqual(err.name, 'NotFoundError');
|
||||||
assert.equal(err.message, 'Job with id undefined not found');
|
assert.strictEqual(err.message, 'Job with id undefined not found');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -83,11 +83,11 @@ describe('job backend', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.job_id, jobCreated.job_id);
|
assert.strictEqual(job.job_id, jobCreated.job_id);
|
||||||
assert.equal(job.user, jobData.data.user);
|
assert.strictEqual(job.user, jobData.data.user);
|
||||||
assert.equal(job.query, jobData.data.query);
|
assert.strictEqual(job.query, jobData.data.query);
|
||||||
assert.equal(job.host, jobData.data.host);
|
assert.strictEqual(job.host, jobData.data.host);
|
||||||
assert.equal(job.status, jobStatus.PENDING);
|
assert.strictEqual(job.status, jobStatus.PENDING);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -110,7 +110,7 @@ describe('job backend', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(jobUpdated.query, 'select pg_sleep(1)');
|
assert.strictEqual(jobUpdated.query, 'select pg_sleep(1)');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -121,8 +121,8 @@ describe('job backend', function () {
|
|||||||
|
|
||||||
jobBackend.update(job.data, function (err) {
|
jobBackend.update(job.data, function (err) {
|
||||||
assert.ok(err, err);
|
assert.ok(err, err);
|
||||||
assert.equal(err.name, 'NotFoundError');
|
assert.strictEqual(err.name, 'NotFoundError');
|
||||||
assert.equal(err.message, 'Job with id ' + job.data.job_id + ' not found');
|
assert.strictEqual(err.message, 'Job with id ' + job.data.job_id + ' not found');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -137,10 +137,10 @@ describe('job backend', function () {
|
|||||||
|
|
||||||
assert.ok(jobSaved.job_id);
|
assert.ok(jobSaved.job_id);
|
||||||
|
|
||||||
assert.equal(jobSaved.user, job.data.user);
|
assert.strictEqual(jobSaved.user, job.data.user);
|
||||||
assert.equal(jobSaved.query, job.data.query);
|
assert.strictEqual(jobSaved.query, job.data.query);
|
||||||
assert.equal(jobSaved.host, job.data.host);
|
assert.strictEqual(jobSaved.host, job.data.host);
|
||||||
assert.equal(jobSaved.status, jobStatus.PENDING);
|
assert.strictEqual(jobSaved.status, jobStatus.PENDING);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -167,7 +167,7 @@ describe('job backend', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
assert.deepEqual(results[2], ['wadus']);
|
assert.deepStrictEqual(results[2], ['wadus']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -192,9 +192,9 @@ describe('job backend', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(users.userA);
|
assert.ok(users.userA);
|
||||||
assert.deepEqual(users.userA, ['jobId1', 'jobId2']);
|
assert.deepStrictEqual(users.userA, ['jobId1', 'jobId2']);
|
||||||
assert.ok(users.userB);
|
assert.ok(users.userB);
|
||||||
assert.deepEqual(users.userB, ['jobId3']);
|
assert.deepStrictEqual(users.userB, ['jobId3']);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -89,7 +89,7 @@ describe('job canceller', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.data.job_id, jobCreated.job_id);
|
assert.strictEqual(job.data.job_id, jobCreated.job_id);
|
||||||
|
|
||||||
runQueryHelper(job.data, function (err) {
|
runQueryHelper(job.data, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -25,8 +25,8 @@ describe('job publisher', function () {
|
|||||||
client.subscribe(Channel.NAME);
|
client.subscribe(Channel.NAME);
|
||||||
|
|
||||||
client.on('message', function (channel, host) {
|
client.on('message', function (channel, host) {
|
||||||
assert.equal(host, HOST);
|
assert.strictEqual(host, HOST);
|
||||||
assert.equal(channel, Channel.NAME);
|
assert.strictEqual(channel, Channel.NAME);
|
||||||
client.unsubscribe(Channel.NAME);
|
client.unsubscribe(Channel.NAME);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -44,8 +44,8 @@ describe('job queue', function () {
|
|||||||
|
|
||||||
self.jobQueue.scanQueues(function (err, queues) {
|
self.jobQueue.scanQueues(function (err, queues) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(queues.length, 1);
|
assert.strictEqual(queues.length, 1);
|
||||||
assert.equal(queues[0], userA);
|
assert.strictEqual(queues[0], userA);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -65,7 +65,7 @@ describe('job queue', function () {
|
|||||||
|
|
||||||
self.jobQueue.scanQueues(function (err, queues) {
|
self.jobQueue.scanQueues(function (err, queues) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(queues.length, 2);
|
assert.strictEqual(queues.length, 2);
|
||||||
assert.ok(queues[0] === userA || queues[0] === userB);
|
assert.ok(queues[0] === userA || queues[0] === userB);
|
||||||
assert.ok(queues[1] === userA || queues[1] === userB);
|
assert.ok(queues[1] === userA || queues[1] === userB);
|
||||||
|
|
||||||
@ -79,12 +79,12 @@ describe('job queue', function () {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var redisArgs = [JobQueue.QUEUE.PREFIX + userA, 'wadus-id'];
|
var redisArgs = [JobQueue.QUEUE.PREFIX + userA, 'wadus-id'];
|
||||||
metadataBackend.redisCmd(JobQueue.QUEUE.DB, 'LPUSH', redisArgs, function (err) {
|
metadataBackend.redisCmd(JobQueue.QUEUE.DB, 'LPUSH', redisArgs, function (err) {
|
||||||
assert.ok(!err, err);
|
assert.ifError(err);
|
||||||
self.jobQueue.scanQueues(function (err, queues) {
|
self.jobQueue.scanQueues(function (err, queues) {
|
||||||
assert.ok(!err, err);
|
assert.ifError(err);
|
||||||
|
|
||||||
assert.equal(queues.length, 1);
|
assert.strictEqual(queues.length, 1);
|
||||||
assert.equal(queues[0], userA);
|
assert.strictEqual(queues[0], userA);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -110,7 +110,7 @@ describe('job queue', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(queuesFromScan.length, 1);
|
assert.strictEqual(queuesFromScan.length, 1);
|
||||||
assert.ok(queuesFromScan.indexOf(data.user) >= 0);
|
assert.ok(queuesFromScan.indexOf(data.user) >= 0);
|
||||||
|
|
||||||
self.jobQueue.getQueues(function (err, queuesFromIndex) {
|
self.jobQueue.getQueues(function (err, queuesFromIndex) {
|
||||||
@ -118,7 +118,7 @@ describe('job queue', function () {
|
|||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(queuesFromIndex.length, 1);
|
assert.strictEqual(queuesFromIndex.length, 1);
|
||||||
assert.ok(queuesFromIndex.indexOf(data.user) >= 0);
|
assert.ok(queuesFromIndex.indexOf(data.user) >= 0);
|
||||||
|
|
||||||
redisUtils.clean('batch:*', done);
|
redisUtils.clean('batch:*', done);
|
||||||
@ -157,7 +157,7 @@ describe('job queue', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(queuesFromScan.length, 2);
|
assert.strictEqual(queuesFromScan.length, 2);
|
||||||
assert.ok(queuesFromScan.indexOf(jobVizzuality.user) >= 0);
|
assert.ok(queuesFromScan.indexOf(jobVizzuality.user) >= 0);
|
||||||
assert.ok(queuesFromScan.indexOf(jobWadus.user) >= 0);
|
assert.ok(queuesFromScan.indexOf(jobWadus.user) >= 0);
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ describe('job queue', function () {
|
|||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(queuesFromIndex.length, 2);
|
assert.strictEqual(queuesFromIndex.length, 2);
|
||||||
assert.ok(queuesFromIndex.indexOf(jobVizzuality.user) >= 0);
|
assert.ok(queuesFromIndex.indexOf(jobVizzuality.user) >= 0);
|
||||||
assert.ok(queuesFromIndex.indexOf(jobWadus.user) >= 0);
|
assert.ok(queuesFromIndex.indexOf(jobWadus.user) >= 0);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ describe('job runner', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.data.status, jobStatus.DONE);
|
assert.strictEqual(job.data.status, jobStatus.DONE);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -72,8 +72,8 @@ describe('job runner', function () {
|
|||||||
it('.run() should return a job not found error', function (done) {
|
it('.run() should return a job not found error', function (done) {
|
||||||
jobRunner.run('wadus_job_id', function (err) {
|
jobRunner.run('wadus_job_id', function (err) {
|
||||||
assert.ok(err, err);
|
assert.ok(err, err);
|
||||||
assert.equal(err.name, 'NotFoundError');
|
assert.strictEqual(err.name, 'NotFoundError');
|
||||||
assert.equal(err.message, 'Job with id wadus_job_id not found');
|
assert.strictEqual(err.message, 'Job with id wadus_job_id not found');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,7 @@ describe('job service', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(job.data.job_id, jobCreated.data.job_id);
|
assert.strictEqual(job.data.job_id, jobCreated.data.job_id);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -103,7 +103,7 @@ describe('job service', function () {
|
|||||||
it('.get() should return a not found error', function (done) {
|
it('.get() should return a not found error', function (done) {
|
||||||
jobService.get('wadus_job_id', function (err) {
|
jobService.get('wadus_job_id', function (err) {
|
||||||
assert.ok(err);
|
assert.ok(err);
|
||||||
assert.equal(err.message, 'Job with id wadus_job_id not found');
|
assert.strictEqual(err.message, 'Job with id wadus_job_id not found');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -115,7 +115,7 @@ describe('job service', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(jobCreated.data.job_id);
|
assert.ok(jobCreated.data.job_id);
|
||||||
assert.equal(jobCreated.data.status, jobStatus.PENDING);
|
assert.strictEqual(jobCreated.data.status, jobStatus.PENDING);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -127,7 +127,7 @@ describe('job service', function () {
|
|||||||
|
|
||||||
jobService.create(job, function (err) {
|
jobService.create(job, function (err) {
|
||||||
assert.ok(err);
|
assert.ok(err);
|
||||||
assert.equal(err.message, 'You must indicate a valid SQL');
|
assert.strictEqual(err.message, 'You must indicate a valid SQL');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -151,8 +151,8 @@ describe('job service', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(jobCancelled.data.job_id, job.data.job_id);
|
assert.strictEqual(jobCancelled.data.job_id, job.data.job_id);
|
||||||
assert.equal(jobCancelled.data.status, jobStatus.CANCELLED);
|
assert.strictEqual(jobCancelled.data.status, jobStatus.CANCELLED);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -162,8 +162,8 @@ describe('job service', function () {
|
|||||||
it('.cancel() should return a job not found error', function (done) {
|
it('.cancel() should return a job not found error', function (done) {
|
||||||
jobService.cancel('wadus_job_id', function (err) {
|
jobService.cancel('wadus_job_id', function (err) {
|
||||||
assert.ok(err, err);
|
assert.ok(err, err);
|
||||||
assert.equal(err.name, 'NotFoundError');
|
assert.strictEqual(err.name, 'NotFoundError');
|
||||||
assert.equal(err.message, 'Job with id wadus_job_id not found');
|
assert.strictEqual(err.message, 'Job with id wadus_job_id not found');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -187,8 +187,8 @@ describe('job service', function () {
|
|||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(jobDrained.job_id, job.data.job_id);
|
assert.strictEqual(jobDrained.job_id, job.data.job_id);
|
||||||
assert.equal(jobDrained.status, jobStatus.PENDING);
|
assert.strictEqual(jobDrained.status, jobStatus.PENDING);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -198,8 +198,8 @@ describe('job service', function () {
|
|||||||
it('.drain() should return a job not found error', function (done) {
|
it('.drain() should return a job not found error', function (done) {
|
||||||
jobService.drain('wadus_job_id', function (err) {
|
jobService.drain('wadus_job_id', function (err) {
|
||||||
assert.ok(err, err);
|
assert.ok(err, err);
|
||||||
assert.equal(err.name, 'NotFoundError');
|
assert.strictEqual(err.name, 'NotFoundError');
|
||||||
assert.equal(err.message, 'Job with id wadus_job_id not found');
|
assert.strictEqual(err.message, 'Job with id wadus_job_id not found');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ describe('locker', function () {
|
|||||||
// others can't lock on same host
|
// others can't lock on same host
|
||||||
lockerB.lock(host, function (err) {
|
lockerB.lock(host, function (err) {
|
||||||
assert.ok(err);
|
assert.ok(err);
|
||||||
assert.equal(err.name, 'LockError');
|
assert.strictEqual(err.name, 'LockError');
|
||||||
|
|
||||||
lockerA.unlock(host, function (err) {
|
lockerA.unlock(host, function (err) {
|
||||||
assert.ok(!err);
|
assert.ok(!err);
|
||||||
|
@ -62,12 +62,12 @@ describe('scheduler', function () {
|
|||||||
scheduler.on('done', function () {
|
scheduler.on('done', function () {
|
||||||
var results = taskRunner.results;
|
var results = taskRunner.results;
|
||||||
|
|
||||||
assert.equal(results.length, 4);
|
assert.strictEqual(results.length, 4);
|
||||||
|
|
||||||
assert.equal(results[0], USER_A);
|
assert.strictEqual(results[0], USER_A);
|
||||||
assert.equal(results[1], USER_B);
|
assert.strictEqual(results[1], USER_B);
|
||||||
assert.equal(results[2], USER_A);
|
assert.strictEqual(results[2], USER_A);
|
||||||
assert.equal(results[3], USER_B);
|
assert.strictEqual(results[3], USER_B);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -86,12 +86,12 @@ describe('scheduler', function () {
|
|||||||
|
|
||||||
scheduler.on('done', function () {
|
scheduler.on('done', function () {
|
||||||
debug('Users %j', acquiredUsers);
|
debug('Users %j', acquiredUsers);
|
||||||
assert.equal(acquiredUsers[0], USER_A);
|
assert.strictEqual(acquiredUsers[0], USER_A);
|
||||||
assert.equal(acquiredUsers[1], USER_B);
|
assert.strictEqual(acquiredUsers[1], USER_B);
|
||||||
assert.equal(acquiredUsers[2], USER_A);
|
assert.strictEqual(acquiredUsers[2], USER_A);
|
||||||
assert.equal(acquiredUsers[3], USER_B);
|
assert.strictEqual(acquiredUsers[3], USER_B);
|
||||||
|
|
||||||
assert.equal(acquiredUsers.length, 4);
|
assert.strictEqual(acquiredUsers.length, 4);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -128,9 +128,9 @@ describe('scheduler', function () {
|
|||||||
scheduler.on('done', function () {
|
scheduler.on('done', function () {
|
||||||
var results = taskRunner.results;
|
var results = taskRunner.results;
|
||||||
|
|
||||||
assert.equal(results.length, 1);
|
assert.strictEqual(results.length, 1);
|
||||||
|
|
||||||
assert.equal(results[0], USER_A);
|
assert.strictEqual(results[0], USER_A);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -152,11 +152,11 @@ describe('scheduler', function () {
|
|||||||
scheduler.on('done', function () {
|
scheduler.on('done', function () {
|
||||||
var results = taskRunner.results;
|
var results = taskRunner.results;
|
||||||
|
|
||||||
assert.equal(results.length, 3);
|
assert.strictEqual(results.length, 3);
|
||||||
|
|
||||||
assert.equal(results[0], USER_A);
|
assert.strictEqual(results[0], USER_A);
|
||||||
assert.equal(results[1], USER_B);
|
assert.strictEqual(results[1], USER_B);
|
||||||
assert.equal(results[2], USER_C);
|
assert.strictEqual(results[2], USER_C);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@ -182,14 +182,14 @@ describe('scheduler', function () {
|
|||||||
scheduler.on('done', function () {
|
scheduler.on('done', function () {
|
||||||
var results = taskRunner.results;
|
var results = taskRunner.results;
|
||||||
|
|
||||||
assert.equal(results.length, 6);
|
assert.strictEqual(results.length, 6);
|
||||||
|
|
||||||
assert.equal(results[0], USER_A);
|
assert.strictEqual(results[0], USER_A);
|
||||||
assert.equal(results[1], USER_B);
|
assert.strictEqual(results[1], USER_B);
|
||||||
assert.equal(results[2], USER_C);
|
assert.strictEqual(results[2], USER_C);
|
||||||
assert.equal(results[3], USER_A);
|
assert.strictEqual(results[3], USER_A);
|
||||||
assert.equal(results[4], USER_B);
|
assert.strictEqual(results[4], USER_B);
|
||||||
assert.equal(results[5], USER_A);
|
assert.strictEqual(results[5], USER_A);
|
||||||
|
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ describe('stream copy', function () {
|
|||||||
};
|
};
|
||||||
const sql = 'COPY dummy_table FROM STDIN';
|
const sql = 'COPY dummy_table FROM STDIN';
|
||||||
const streamCopy = new StreamCopy(sql, userDbParams);
|
const streamCopy = new StreamCopy(sql, userDbParams);
|
||||||
assert.equal(streamCopy.dbParams.port, global.settings.db_batch_port);
|
assert.strictEqual(streamCopy.dbParams.port, global.settings.db_batch_port);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -80,7 +80,7 @@ assert.response = function (server, req, res, callback) {
|
|||||||
|
|
||||||
// Assert response status
|
// Assert response status
|
||||||
if (typeof status === 'number') {
|
if (typeof status === 'number') {
|
||||||
assert.equal(response.statusCode, status,
|
assert.strictEqual(response.statusCode, status,
|
||||||
colorize('[red]{Invalid response status code.}\n' +
|
colorize('[red]{Invalid response status code.}\n' +
|
||||||
' Expected: [green]{' + status + '}\n' +
|
' Expected: [green]{' + status + '}\n' +
|
||||||
' Got: [red]{' + response.statusCode + '}\n' +
|
' Got: [red]{' + response.statusCode + '}\n' +
|
||||||
|
@ -277,7 +277,7 @@ JobResult.prototype.validateExpectedResponse = function (expected) {
|
|||||||
var expectedQuery = expected.query[index];
|
var expectedQuery = expected.query[index];
|
||||||
assert.ok(expectedQuery);
|
assert.ok(expectedQuery);
|
||||||
Object.keys(expectedQuery).forEach(function (expectedKey) {
|
Object.keys(expectedQuery).forEach(function (expectedKey) {
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
actualQuery[expectedKey],
|
actualQuery[expectedKey],
|
||||||
expectedQuery[expectedKey],
|
expectedQuery[expectedKey],
|
||||||
'Expected value for key "' + expectedKey + '" does not match: ' + actualQuery[expectedKey] + ' ==' +
|
'Expected value for key "' + expectedKey + '" does not match: ' + actualQuery[expectedKey] + ' ==' +
|
||||||
@ -293,6 +293,6 @@ JobResult.prototype.validateExpectedResponse = function (expected) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(actual.onsuccess, expected.onsuccess);
|
assert.strictEqual(actual.onsuccess, expected.onsuccess);
|
||||||
assert.equal(actual.onerror, expected.onerror);
|
assert.strictEqual(actual.onerror, expected.onerror);
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,7 @@ describe.skip('has credentials', function () {
|
|||||||
|
|
||||||
function testCredentials (req, hasCredentials) {
|
function testCredentials (req, hasCredentials) {
|
||||||
var apiKeyAuth = new ApikeyAuth(req);
|
var apiKeyAuth = new ApikeyAuth(req);
|
||||||
assert.equal(apiKeyAuth.hasCredentials(), hasCredentials);
|
assert.strictEqual(apiKeyAuth.hasCredentials(), hasCredentials);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ describe.skip('verifyCredentials', function () {
|
|||||||
function testVerifyCredentials (req, options, shouldBeValid, done) {
|
function testVerifyCredentials (req, options, shouldBeValid, done) {
|
||||||
var apiKeyAuth = new ApikeyAuth(req);
|
var apiKeyAuth = new ApikeyAuth(req);
|
||||||
apiKeyAuth.verifyCredentials(options, function (err, validCredentials) {
|
apiKeyAuth.verifyCredentials(options, function (err, validCredentials) {
|
||||||
assert.equal(validCredentials, shouldBeValid);
|
assert.strictEqual(validCredentials, shouldBeValid);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ describe('error-handler-factory', function () {
|
|||||||
name: codeToCondition[error.code] || error.name
|
name: codeToCondition[error.code] || error.name
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(errorHandler, expectedError);
|
assert.deepStrictEqual(errorHandler, expectedError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ describe('error-handler-factory', function () {
|
|||||||
http_status: 429
|
http_status: 429
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(errorHandler, expectedError);
|
assert.deepStrictEqual(errorHandler, expectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('permission denied error', function () {
|
it('permission denied error', function () {
|
||||||
@ -66,6 +66,6 @@ describe('error-handler-factory', function () {
|
|||||||
name: codeToCondition[error.code] || error.name
|
name: codeToCondition[error.code] || error.name
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(errorHandler, expectedError);
|
assert.deepStrictEqual(errorHandler, expectedError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -52,7 +52,7 @@ describe('error-handler', function () {
|
|||||||
|
|
||||||
errorMiddleware()(error, req, res, function next () {
|
errorMiddleware()(error, req, res, function next () {
|
||||||
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
res.headers['X-SQLAPI-Errors'],
|
res.headers['X-SQLAPI-Errors'],
|
||||||
JSON.stringify(errorHeader)
|
JSON.stringify(errorHeader)
|
||||||
);
|
);
|
||||||
@ -78,7 +78,7 @@ describe('error-handler', function () {
|
|||||||
|
|
||||||
errorMiddleware()(error, req, res, function next () {
|
errorMiddleware()(error, req, res, function next () {
|
||||||
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
res.headers['X-SQLAPI-Errors'],
|
res.headers['X-SQLAPI-Errors'],
|
||||||
JSON.stringify(errorHeader)
|
JSON.stringify(errorHeader)
|
||||||
);
|
);
|
||||||
@ -107,7 +107,7 @@ describe('error-handler', function () {
|
|||||||
|
|
||||||
errorMiddleware()(error, req, res, function () {
|
errorMiddleware()(error, req, res, function () {
|
||||||
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
res.headers['X-SQLAPI-Errors'],
|
res.headers['X-SQLAPI-Errors'],
|
||||||
JSON.stringify(errorHeader)
|
JSON.stringify(errorHeader)
|
||||||
);
|
);
|
||||||
@ -131,7 +131,7 @@ describe('error-handler', function () {
|
|||||||
|
|
||||||
errorMiddleware()(error, req, res, function () {
|
errorMiddleware()(error, req, res, function () {
|
||||||
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
assert.ok(res.headers['X-SQLAPI-Errors'].length > 0);
|
||||||
assert.deepEqual(
|
assert.deepStrictEqual(
|
||||||
res.headers['X-SQLAPI-Errors'],
|
res.headers['X-SQLAPI-Errors'],
|
||||||
JSON.stringify(expectedErrorHeader)
|
JSON.stringify(expectedErrorHeader)
|
||||||
);
|
);
|
||||||
|
@ -22,8 +22,8 @@ describe('health checks', function () {
|
|||||||
callback(null, 'Maintenance');
|
callback(null, 'Maintenance');
|
||||||
};
|
};
|
||||||
healthCheck.check(function (err) {
|
healthCheck.check(function (err) {
|
||||||
assert.equal(err.message, 'Maintenance');
|
assert.strictEqual(err.message, 'Maintenance');
|
||||||
assert.equal(err.http_status, 503);
|
assert.strictEqual(err.http_status, 503);
|
||||||
fs.readFile = readFileFn;
|
fs.readFile = readFileFn;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -37,7 +37,7 @@ describe('health checks', function () {
|
|||||||
callback(new Error('ENOENT'), null);
|
callback(new Error('ENOENT'), null);
|
||||||
};
|
};
|
||||||
healthCheck.check(function (err) {
|
healthCheck.check(function (err) {
|
||||||
assert.equal(err, null);
|
assert.strictEqual(err, undefined);
|
||||||
fs.readFile = readFileFn;
|
fs.readFile = readFileFn;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -8,31 +8,31 @@ var ArrayBufferSer = require('../../../lib/models/bin-encoder');
|
|||||||
describe('ArrayBufferSer', function () {
|
describe('ArrayBufferSer', function () {
|
||||||
it('calculate size for basic types', function () {
|
it('calculate size for basic types', function () {
|
||||||
var b = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 2, 3, 4]);
|
var b = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 2, 3, 4]);
|
||||||
assert.equal(4 * 2, b.getDataSize());
|
assert.strictEqual(4 * 2, b.getDataSize());
|
||||||
|
|
||||||
b = new ArrayBufferSer(ArrayBufferSer.INT8, [1, 2, 3, 4]);
|
b = new ArrayBufferSer(ArrayBufferSer.INT8, [1, 2, 3, 4]);
|
||||||
assert.equal(4, b.getDataSize());
|
assert.strictEqual(4, b.getDataSize());
|
||||||
|
|
||||||
b = new ArrayBufferSer(ArrayBufferSer.INT32, [1, 2, 3, 4]);
|
b = new ArrayBufferSer(ArrayBufferSer.INT32, [1, 2, 3, 4]);
|
||||||
assert.equal(4 * 4, b.getDataSize());
|
assert.strictEqual(4 * 4, b.getDataSize());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calculate size for arrays', function () {
|
it('calculate size for arrays', function () {
|
||||||
var b = new ArrayBufferSer(ArrayBufferSer.STRING, ['test', 'kease']);
|
var b = new ArrayBufferSer(ArrayBufferSer.STRING, ['test', 'kease']);
|
||||||
assert.equal((b.headerSize + 4 + 5) * 2, b.getDataSize());
|
assert.strictEqual((b.headerSize + 4 + 5) * 2, b.getDataSize());
|
||||||
|
|
||||||
var ba = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 2, 3, 4]);
|
var ba = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 2, 3, 4]);
|
||||||
var bc = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 4]);
|
var bc = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 4]);
|
||||||
|
|
||||||
b = new ArrayBufferSer(ArrayBufferSer.BUFFER, [ba, bc]);
|
b = new ArrayBufferSer(ArrayBufferSer.BUFFER, [ba, bc]);
|
||||||
assert.equal((b.headerSize + 4 + 2) * 2, b.getDataSize());
|
assert.strictEqual((b.headerSize + 4 + 2) * 2, b.getDataSize());
|
||||||
assert.equal(b.type, ArrayBufferSer.BUFFER);
|
assert.strictEqual(b.type, ArrayBufferSer.BUFFER);
|
||||||
});
|
});
|
||||||
|
|
||||||
function assert_buffer_equals (a, b) {
|
function assert_buffer_equals (a, b) {
|
||||||
assert.equal(a.length, b.length);
|
assert.strictEqual(a.length, b.length);
|
||||||
for (var i = 0; i < a.length; ++i) {
|
for (var i = 0; i < a.length; ++i) {
|
||||||
assert.equal(a[i], b[i], 'byte i ' + i + ' is different: ' + a[i] + ' != ' + b[i]);
|
assert.strictEqual(a[i], b[i], 'byte i ' + i + ' is different: ' + a[i] + ' != ' + b[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,11 +45,11 @@ var metadataBackend = new MetadataDB({
|
|||||||
|
|
||||||
describe('oauth', function () {
|
describe('oauth', function () {
|
||||||
it('test database number', function () {
|
it('test database number', function () {
|
||||||
assert.equal(oAuth.oauth_database, 3);
|
assert.strictEqual(oAuth.oauth_database, 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test oauth database key', function () {
|
it('test oauth database key', function () {
|
||||||
assert.equal(oAuth.oauth_user_key, 'rails:oauth_access_tokens:<%= oauth_access_key %>');
|
assert.strictEqual(oAuth.oauth_user_key, 'rails:oauth_access_tokens:<%= oauth_access_key %>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test parse tokens from full headers does not raise exception', function () {
|
it('test parse tokens from full headers does not raise exception', function () {
|
||||||
@ -65,7 +65,7 @@ describe('oauth', function () {
|
|||||||
it('test headers take presedence over query parameters', function () {
|
it('test headers take presedence over query parameters', function () {
|
||||||
var req = { query: { oauth_signature_method: 'MY_HASH' }, headers: { authorization: full_oauth_header } };
|
var req = { query: { oauth_signature_method: 'MY_HASH' }, headers: { authorization: full_oauth_header } };
|
||||||
var tokens = oAuth.parseTokens(req);
|
var tokens = oAuth.parseTokens(req);
|
||||||
assert.equal(tokens.oauth_signature_method, 'HMAC-SHA1');
|
assert.strictEqual(tokens.oauth_signature_method, 'HMAC-SHA1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test can access oauth hash for a user based on access token (oauth_token)', function (done) {
|
it('test can access oauth hash for a user based on access token (oauth_token)', function (done) {
|
||||||
@ -73,7 +73,8 @@ describe('oauth', function () {
|
|||||||
var tokens = oAuth.parseTokens(req);
|
var tokens = oAuth.parseTokens(req);
|
||||||
|
|
||||||
oAuth.getOAuthHash(metadataBackend, tokens.oauth_token, function (err, data) {
|
oAuth.getOAuthHash(metadataBackend, tokens.oauth_token, function (err, data) {
|
||||||
assert.equal(tokens.oauth_consumer_key, data.consumer_key);
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(tokens.oauth_consumer_key, data.consumer_key);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -83,8 +84,8 @@ describe('oauth', function () {
|
|||||||
var tokens = oAuth.parseTokens(req);
|
var tokens = oAuth.parseTokens(req);
|
||||||
|
|
||||||
oAuth.getOAuthHash(metadataBackend, tokens.oauth_token, function (err, data) {
|
oAuth.getOAuthHash(metadataBackend, tokens.oauth_token, function (err, data) {
|
||||||
assert.ok(!err, err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(data, {});
|
assert.deepStrictEqual(data, {});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -100,8 +101,8 @@ describe('oauth', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
||||||
assert.ok(!err, err);
|
assert.ifError(err);
|
||||||
assert.equal(data, 'master');
|
assert.strictEqual(data, 'master');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -122,8 +123,8 @@ describe('oauth', function () {
|
|||||||
|
|
||||||
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
||||||
oAuth.getAllowedHosts = oAuthGetAllowedHostsFn;
|
oAuth.getAllowedHosts = oAuthGetAllowedHostsFn;
|
||||||
assert.ok(!err, err);
|
assert.ifError(err);
|
||||||
assert.equal(data, 'master');
|
assert.strictEqual(data, 'master');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -139,7 +140,7 @@ describe('oauth', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
||||||
assert.equal(data, null);
|
assert.strictEqual(data, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -155,7 +156,7 @@ describe('oauth', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
oAuth.verifyRequest(req, metadataBackend, function (err, data) {
|
||||||
assert.equal(data, null);
|
assert.strictEqual(data, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -170,7 +171,7 @@ describe('oauth', function () {
|
|||||||
it('OAuthAuth reports it has no credentials', function (done) {
|
it('OAuthAuth reports it has no credentials', function (done) {
|
||||||
var req = { query: {}, headers: {} };
|
var req = { query: {}, headers: {} };
|
||||||
var oAuthAuth = new OAuthAuth(req);
|
var oAuthAuth = new OAuthAuth(req);
|
||||||
assert.equal(oAuthAuth.hasCredentials(), false);
|
assert.strictEqual(oAuthAuth.hasCredentials(), false);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,7 +17,7 @@ describe('query info', function () {
|
|||||||
validQueries.forEach(query => {
|
validQueries.forEach(query => {
|
||||||
it(query, function () {
|
it(query, function () {
|
||||||
const result = queryInfo.getFormatFromCopyQuery(query);
|
const result = queryInfo.getFormatFromCopyQuery(query);
|
||||||
assert.equal(result, 'CSV');
|
assert.strictEqual(result, 'CSV');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -31,7 +31,7 @@ describe('query info', function () {
|
|||||||
validQueries.forEach(query => {
|
validQueries.forEach(query => {
|
||||||
it(query, function () {
|
it(query, function () {
|
||||||
const result = queryInfo.getFormatFromCopyQuery(query);
|
const result = queryInfo.getFormatFromCopyQuery(query);
|
||||||
assert.equal(result, 'TEXT');
|
assert.strictEqual(result, 'TEXT');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -44,7 +44,7 @@ describe('query info', function () {
|
|||||||
validQueries.forEach(query => {
|
validQueries.forEach(query => {
|
||||||
it(query, function () {
|
it(query, function () {
|
||||||
const result = queryInfo.getFormatFromCopyQuery(query);
|
const result = queryInfo.getFormatFromCopyQuery(query);
|
||||||
assert.equal(result, 'BINARY');
|
assert.strictEqual(result, 'BINARY');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user