diff --git a/lib/batch/models/job-state-machine.js b/lib/batch/models/job-state-machine.js index 750d5d20..64bbc3b6 100644 --- a/lib/batch/models/job-state-machine.js +++ b/lib/batch/models/job-state-machine.js @@ -24,7 +24,7 @@ JobStateMachine.prototype.isValidTransition = function (initialStatus, finalStat for (var i = 0; i < validStatusTransitions.length; i++) { try { - assert.deepEqual(transition, validStatusTransitions[i]); + assert.deepStrictEqual(transition, validStatusTransitions[i]); return true; } catch (e) { continue; diff --git a/test/acceptance/app-auth-test.js b/test/acceptance/app-auth-test.js index dea6b222..c5f6f819 100644 --- a/test/acceptance/app-auth-test.js +++ b/test/acceptance/app-auth-test.js @@ -56,7 +56,7 @@ describe('app.auth', function () { }, {}, function (err, res) { - assert.equal(res.statusCode, scenario.statusCode, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, scenario.statusCode, res.statusCode + ': ' + res.body); done(); } ); diff --git a/test/acceptance/app-configuration-test.js b/test/acceptance/app-configuration-test.js index 47f74de1..61c676e6 100644 --- a/test/acceptance/app-configuration-test.js +++ b/test/acceptance/app-configuration-test.js @@ -35,7 +35,7 @@ describe('app-configuration', function () { var parsed = JSON.parse(res.body); var sqlapi_version = require(__dirname + '/../../package.json').version; 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(); }); }); @@ -48,9 +48,9 @@ describe('app-configuration', function () { }, { status: 400 }, function (err, res) { - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.deepEqual(JSON.parse(res.body), { error: ['You must indicate a sql query'] }); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.deepStrictEqual(JSON.parse(res.body), { error: ['You must indicate a sql query'] }); done(); }); }); @@ -71,15 +71,15 @@ describe('app-configuration', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, RESPONSE_OK, function (err, res) { - assert.equal( + assert.strictEqual( res.headers['access-control-allow-headers'], accessControlHeaders ); - assert.equal( + assert.strictEqual( res.headers['access-control-expose-headers'], exposedHeaders ); - assert.equal(res.headers['access-control-allow-origin'], '*'); + assert.strictEqual(res.headers['access-control-allow-origin'], '*'); done(); }); }); @@ -91,16 +91,16 @@ describe('app-configuration', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'OPTIONS' }, RESPONSE_OK, function (err, res) { - assert.equal(res.body, ''); - assert.equal( + assert.strictEqual(res.body, ''); + assert.strictEqual( res.headers['access-control-allow-headers'], accessControlHeaders ); - assert.equal( + assert.strictEqual( res.headers['access-control-expose-headers'], exposedHeaders ); - assert.equal(res.headers['access-control-allow-origin'], '*'); + assert.strictEqual(res.headers['access-control-allow-origin'], '*'); done(); }); }); @@ -115,8 +115,8 @@ describe('app-configuration', function () { // Check cache headers assert.ok(res.headers.hasOwnProperty('x-cache-channel')); // 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.equal(res.headers['cache-control'], expected_cache_control_persist); + assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4'); + assert.strictEqual(res.headers['cache-control'], expected_cache_control_persist); done(); }); }); @@ -133,8 +133,8 @@ describe('app-configuration', function () { global.settings.db_host = backupDBHost; try { var parsed = JSON.parse(res.body); - assert.equal(parsed.rows.length, 1); - assert.equal(parsed.rows[0].n, 2); + assert.strictEqual(parsed.rows.length, 1); + assert.strictEqual(parsed.rows[0].n, 2); } catch (e) { return done(e); } @@ -153,10 +153,10 @@ describe('app-configuration', function () { }, RESPONSE_OK, function (err, res) { global.settings.db_user_pass = backupDBUserPass; 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); - assert.equal(parsed.rows.length, 1); - assert.equal(parsed.rows[0].n, 2); + assert.strictEqual(parsed.rows.length, 1); + assert.strictEqual(parsed.rows[0].n, 2); } catch (e) { return done(e); } @@ -174,14 +174,14 @@ describe('app-configuration', function () { method: 'GET' }, RESPONSE_OK, function (err, res) { // Check cache headers - assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4'); - assert.equal(res.headers['cache-control'], expected_cache_control); - assert.equal(res.headers['access-control-allow-origin'], '*'); - assert.equal( + assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4'); + assert.strictEqual(res.headers['cache-control'], expected_cache_control); + assert.strictEqual(res.headers['access-control-allow-origin'], '*'); + assert.strictEqual( res.headers['access-control-allow-headers'], accessControlHeaders ); - assert.equal( + assert.strictEqual( res.headers['access-control-expose-headers'], exposedHeaders ); diff --git a/test/acceptance/app-test.js b/test/acceptance/app-test.js index fc0e94f5..9103378c 100644 --- a/test/acceptance/app-test.js +++ b/test/acceptance/app-test.js @@ -36,10 +36,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); // Check cache headers - assert.equal(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['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4'); + assert.strictEqual(res.headers['cache-control'], expected_cache_control); done(); }); }); @@ -50,7 +50,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); done(); }); }); @@ -60,7 +60,7 @@ describe('app.test', function () { url: '/user/vizzuality/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); done(); }); }); @@ -72,10 +72,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); // Check cache headers - assert.equal(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['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4'); + assert.strictEqual(res.headers['cache-control'], expected_cache_control); done(); }); }); @@ -87,7 +87,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); done(); }); }); @@ -100,9 +100,9 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 403, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 403, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); assert.ok(JSON.parse(res.body).error[0].match(/permission denied for .+? untitle_table_4/)); done(); }); @@ -115,9 +115,9 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); assert.ok(JSON.parse(res.body).error[0].match(/must be owner of.+? untitle_table_4/)); done(); }); @@ -139,9 +139,9 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); assert.ok(JSON.parse(res.body).error[0].match(/must be owner of.+? untitle_table_4/)); done(); }); @@ -160,8 +160,8 @@ describe('app.test', function () { headers: { host: 'vizzuality.localhost.lan:8080' }, method: 'GET' }, {}, function (err, res) { - assert.equal(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.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.private_table'); done(); }); }); @@ -175,11 +175,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -193,11 +193,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -212,10 +212,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, 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); - assert.equal(parsedBody.total_rows, 1); - assert.deepEqual(parsedBody.rows[0], { b: 2.5 }); + assert.strictEqual(parsedBody.total_rows, 1); + assert.deepStrictEqual(parsedBody.rows[0], { b: 2.5 }); done(); }); }); @@ -229,11 +229,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, 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.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); - assert.equal(pbody.rows.length, 0); + assert.strictEqual(pbody.rows.length, 0); assert.response(server, { url: '/api/v1/sql?' + querystring.stringify({ q: 'SELECT count(*) FROM test_table', @@ -242,7 +242,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, 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 assert.ok(!res.headers.hasOwnProperty('x-cache-channel')); @@ -254,8 +254,8 @@ describe('app.test', function () { assert.ok(Number(value) <= fallbackTtl); var pbody = JSON.parse(res.body); - assert.equal(pbody.total_rows, 1); - assert.equal(pbody.rows[0].count, 0); + assert.strictEqual(pbody.total_rows, 1); + assert.strictEqual(pbody.rows[0].count, 0); done(); }); }); @@ -270,11 +270,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, 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.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); - assert.equal(pbody.rows.length, 0); + assert.strictEqual(pbody.rows.length, 0); done(); }); }); @@ -288,11 +288,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -306,11 +306,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -324,11 +324,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -339,10 +339,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.deepEqual(JSON.parse(res.body), { error: ['Invalid format: unknown'] }); + assert.strictEqual(res.statusCode, 400, res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.deepStrictEqual(JSON.parse(res.body), { error: ['Invalid format: unknown'] }); done(); }); }); @@ -353,12 +353,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var ct = res.headers['content-type']; assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct); var cd = res.headers['content-disposition']; - assert.equal(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, /^inline/.test(cd), 'Default format is not disposed inline: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.json/gi.test(cd), 'Unexpected JSON filename: ' + cd); done(); }); }); @@ -370,12 +370,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var ct = res.headers['content-type']; assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct); var cd = res.headers['content-disposition']; - assert.equal(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, /^inline/.test(cd), 'Default format is not disposed inline: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.json/gi.test(cd), 'Unexpected JSON filename: ' + cd); done(); }); }); @@ -386,12 +386,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var ct = res.headers['content-type']; assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct); var cd = res.headers['content-disposition']; - assert.equal(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, /^attachment/.test(cd), 'Format with filename is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=x.json/gi.test(cd), 'Unexpected JSON filename: ' + cd); done(); }); }); @@ -405,9 +405,9 @@ describe('app.test', function () { status: 400 }, function (err, res) { var cd = res.headers['access-control-allow-origin']; - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.equal(cd, '*'); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(cd, '*'); done(); }); }); @@ -418,11 +418,11 @@ describe('app.test', function () { headers: { host: 'vizzualinot.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 404, res.statusCode + (res.statusCode !== 200 ? (': ' + res.body) : '')); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 404, res.statusCode + (res.statusCode !== 200 ? (': ' + res.body) : '')); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); var result = JSON.parse(res.body); - assert.equal( + assert.strictEqual( result.error[0], "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' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); var result = JSON.parse(res.body); // 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(); }); }); @@ -460,16 +460,17 @@ describe('app.test', function () { headers: { host: 'vizzuality.localhost.lan:8080' }, method: 'GET' }, {}, 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); - assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 1); - assert.equal(out.rows.length, 1); - assert.ok(out.rows[0].hasOwnProperty('x')); - assert.equal(out.rows[0].x.length, 2); - assert.equal(out.rows[0].x[0], '8.7'); - assert.equal(out.rows[0].x[1], '4.3'); - assert.equal(res.headers.hasOwnProperty('x-cache-channel'), false); + assert.ok(Object.prototype.hasOwnProperty.call(out, 'time')); + assert.strictEqual(out.total_rows, 1); + assert.strictEqual(out.rows.length, 1); + assert.ok(Object.prototype.hasOwnProperty.call(out.rows[0], 'x')); + assert.strictEqual(out.rows[0].x.length, 2); + assert.strictEqual(out.rows[0].x[0], 8.7); + assert.strictEqual(out.rows[0].x[1], 4.3); + assert.strictEqual(Object.prototype.hasOwnProperty.call(res.headers, 'x-cache-channel'), false); done(); }); }); @@ -490,19 +491,19 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); - assert.equal(_.keys(parsedBody.fields).length, 10); - assert.equal(parsedBody.fields.a.type, 'number'); - assert.equal(parsedBody.fields.b.type, 'number'); - assert.equal(parsedBody.fields.c.type, 'string'); - assert.equal(parsedBody.fields.d.type, 'string'); - assert.equal(parsedBody.fields.e.type, 'date'); - assert.equal(parsedBody.fields.f.type, 'string'); - assert.equal(parsedBody.fields.g.type, 'boolean'); - assert.equal(parsedBody.fields.h.type, 'geometry'); - assert.equal(parsedBody.fields.i.type, 'date'); - assert.equal(parsedBody.fields.j.type, 'number'); + assert.strictEqual(_.keys(parsedBody.fields).length, 10); + assert.strictEqual(parsedBody.fields.a.type, 'number'); + assert.strictEqual(parsedBody.fields.b.type, 'number'); + assert.strictEqual(parsedBody.fields.c.type, 'string'); + assert.strictEqual(parsedBody.fields.d.type, 'string'); + assert.strictEqual(parsedBody.fields.e.type, 'date'); + assert.strictEqual(parsedBody.fields.f.type, 'string'); + assert.strictEqual(parsedBody.fields.g.type, 'boolean'); + assert.strictEqual(parsedBody.fields.h.type, 'geometry'); + assert.strictEqual(parsedBody.fields.i.type, 'date'); + assert.strictEqual(parsedBody.fields.j.type, 'number'); done(); }); }); @@ -526,21 +527,21 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); var row = parsedBody.rows[0]; - assert.equal(typeof (row.a), 'number'); - assert.equal(typeof (row.b), 'number'); - assert.equal(typeof (row.c), 'number'); - assert.equal(typeof (row.d), 'number'); - assert.equal(typeof (row.e), 'number'); - assert.equal(typeof (row.f), 'number'); - assert.equal(typeof (row._a[0]), 'number'); - assert.equal(typeof (row._b[0]), 'number'); - assert.equal(typeof (row._c[0]), 'number'); - assert.equal(typeof (row._d[0]), 'number'); - assert.equal(typeof (row._e[0]), 'number'); - assert.equal(typeof (row._f[0]), 'number'); + assert.strictEqual(typeof (row.a), 'number'); + assert.strictEqual(typeof (row.b), 'number'); + assert.strictEqual(typeof (row.c), 'number'); + assert.strictEqual(typeof (row.d), 'number'); + assert.strictEqual(typeof (row.e), 'number'); + assert.strictEqual(typeof (row.f), 'number'); + assert.strictEqual(typeof (row._a[0]), 'number'); + assert.strictEqual(typeof (row._b[0]), 'number'); + assert.strictEqual(typeof (row._c[0]), 'number'); + assert.strictEqual(typeof (row._d[0]), 'number'); + assert.strictEqual(typeof (row._e[0]), 'number'); + assert.strictEqual(typeof (row._f[0]), 'number'); done(); }); }); @@ -568,9 +569,9 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { try { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, 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(); } catch (err) { next(err); @@ -588,9 +589,9 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { try { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, 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(); } catch (err) { next(err); @@ -608,9 +609,9 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { try { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, 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(); } catch (err) { next(err); @@ -628,9 +629,9 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { try { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, 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(); } catch (err) { next(err); @@ -672,8 +673,8 @@ describe('app.test', function () { try { var parsedBody = JSON.parse(res.body); assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result'); - assert.equal(parsedBody.notices.length, 1); - assert.equal(parsedBody.notices[0], 'hello notice'); + assert.strictEqual(parsedBody.notices.length, 1); + assert.strictEqual(parsedBody.notices[0], 'hello notice'); } catch (e) { return next(e); } @@ -693,8 +694,8 @@ describe('app.test', function () { try { var parsedBody = JSON.parse(res.body); assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result'); - assert.equal(parsedBody.warnings.length, 1); - assert.equal(parsedBody.warnings[0], 'hello warning'); + assert.strictEqual(parsedBody.warnings.length, 1); + assert.strictEqual(parsedBody.warnings[0], 'hello warning'); } catch (e) { return next(e); } @@ -715,11 +716,11 @@ describe('app.test', function () { try { var parsedBody = JSON.parse(res.body); assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result'); - assert.equal(parsedBody.warnings.length, 1); - assert.equal(parsedBody.warnings[0], 'hello again warning'); + assert.strictEqual(parsedBody.warnings.length, 1); + assert.strictEqual(parsedBody.warnings[0], 'hello again warning'); assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result'); - assert.equal(parsedBody.notices.length, 1); - assert.equal(parsedBody.notices[0], 'hello again notice'); + assert.strictEqual(parsedBody.notices.length, 1); + assert.strictEqual(parsedBody.notices[0], 'hello again notice'); } catch (e) { return next(e); } @@ -736,7 +737,7 @@ describe('app.test', function () { method: 'GET' }, RESPONSE_OK, function (err, res) { try { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); JSON.parse(res.body); } catch (e) { err = new Error(err + ',' + e); @@ -753,7 +754,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); assert.ok(res.body.match(/foo\_jsonp\(.*\)/)); done(); }); @@ -765,7 +766,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); var didRunJsonCallback = false; // jshint ignore:start function foo_jsonp (body) { @@ -793,7 +794,7 @@ describe('app.test', function () { }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error.error, [ + assert.deepStrictEqual(error.error, [ 'You are over platform\'s limits: SQL query timeout error.' + ' Refactor your query before running again or contact CARTO support for more details.' ]); @@ -816,7 +817,7 @@ describe('app.test', function () { }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error.error, [ + assert.deepStrictEqual(error.error, [ 'You are over platform\'s limits: SQL query timeout error.' + ' Refactor your query before running again or contact CARTO support for more details.' ]); @@ -839,7 +840,7 @@ describe('app.test', function () { }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error.error, [ + assert.deepStrictEqual(error.error, [ 'You are over platform\'s limits: SQL query timeout error.' + ' Refactor your query before running again or contact CARTO support for more details.' ]); @@ -874,11 +875,11 @@ describe('app.test', function () { status: 400 }, function () { - assert.equal(hit, true); + assert.strictEqual(hit, true); var parsedError = JSON.parse(consoleError); assert.ok(parsedError.error.match(/^row too large.*/i), 'Expecting row size limit error'); - assert.equal(parsedError.username, 'vizzuality'); - assert.equal(parsedError.type, 'row_size_limit_exceeded'); + assert.strictEqual(parsedError.username, 'vizzuality'); + assert.strictEqual(parsedError.type, 'row_size_limit_exceeded'); global.settings.db_max_row_size = dbMaxRowSize; console.error = consoleErrorFn; diff --git a/test/acceptance/auth-api-test.js b/test/acceptance/auth-api-test.js index a196d81b..aa7920b2 100644 --- a/test/acceptance/auth-api-test.js +++ b/test/acceptance/auth-api-test.js @@ -15,7 +15,7 @@ describe('Auth API', function () { this.testClient = new TestClient(); this.testClient.getResult(publicSQL, (err, result) => { assert.ifError(err); - assert.equal(result.length, 6); + assert.strictEqual(result.length, 6); done(); }); }); @@ -31,7 +31,7 @@ describe('Auth API', function () { this.testClient.getResult(publicSQL, expectedResponse, (err, result) => { assert.ifError(err); - assert.equal(result.error, 'Unauthorized'); + assert.deepStrictEqual(result.error, ['Unauthorized']); done(); }); }); @@ -55,7 +55,7 @@ describe('Auth API', function () { this.testClient = new TestClient({ apiKey: 1234 }); this.testClient.getResult(publicSQL, (err, result) => { assert.ifError(err); - assert.equal(result.length, 6); + assert.strictEqual(result.length, 6); done(); }); }); @@ -64,7 +64,7 @@ describe('Auth API', function () { this.testClient = new TestClient({ apiKey: 1234 }); this.testClient.getResult(privateSQL, (err, result) => { assert.ifError(err); - assert.equal(result.length, 5); + assert.strictEqual(result.length, 5); done(); }); }); @@ -73,7 +73,7 @@ describe('Auth API', function () { this.testClient = new TestClient({ apiKey: 'regular1' }); this.testClient.getResult(scopedSQL, (err, result) => { assert.ifError(err); - assert.equal(result.length, 4); + assert.strictEqual(result.length, 4); done(); }); }); @@ -107,7 +107,7 @@ describe('Auth API', function () { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); done(); }); @@ -123,7 +123,7 @@ describe('Auth API', function () { } const body = JSON.parse(response.body); - assert.equal(body.error, 'permission denied'); + assert.deepStrictEqual(body.error, ['permission denied']); done(); }); }); @@ -137,7 +137,7 @@ describe('Auth API', function () { } const body = JSON.parse(response.body); - assert.equal(body.error, 'permission denied'); + assert.deepStrictEqual(body.error, ['permission denied']); done(); }); }); @@ -151,7 +151,7 @@ describe('Auth API', function () { } const body = JSON.parse(response.body); - assert.equal(body.error, 'permission denied'); + assert.deepStrictEqual(body.error, ['permission denied']); done(); }); }); @@ -167,7 +167,7 @@ describe('Auth API', function () { this.testClient.getResult(scopedSQL, { anonymous: true }, (err, result) => { assert.ifError(err); - assert.equal(result.length, 4); + assert.strictEqual(result.length, 4); done(); }); }); @@ -199,7 +199,7 @@ describe('Auth API', function () { this.testClient.getResult(systemSQL, expectedResponse, (err, result) => { assert.ifError(err); - assert.equal(result.error, 'system tables are forbidden'); + assert.deepStrictEqual(result.error, ['system tables are forbidden']); done(); }); }); @@ -215,7 +215,7 @@ describe('Auth API', function () { this.testClient.getResult(scopedSQL, expectedResponse, (err, result) => { assert.ifError(err); - assert.equal(result.error, 'permission denied'); + assert.deepStrictEqual(result.error, ['permission denied']); done(); }); }); @@ -232,7 +232,7 @@ describe('Auth API', function () { this.testClient.getResult(publicSQL, expectedResponse, (err, result) => { assert.ifError(err); - assert.equal(result.error, 'Unauthorized'); + assert.deepStrictEqual(result.error, ['Unauthorized']); done(); }); }); @@ -247,7 +247,7 @@ describe('Auth API', function () { } const body = JSON.parse(response.body); - assert.equal(body.error, 'permission denied'); + assert.deepStrictEqual(body.error, ['permission denied']); done(); }); }); @@ -261,7 +261,7 @@ describe('Auth API', function () { } const body = JSON.parse(response.body); - assert.equal(body.error, 'permission denied'); + assert.deepStrictEqual(body.error, ['permission denied']); done(); }); }); diff --git a/test/acceptance/backend-crash-test.js b/test/acceptance/backend-crash-test.js index 85ff76da..c557d609 100644 --- a/test/acceptance/backend-crash-test.js +++ b/test/acceptance/backend-crash-test.js @@ -35,7 +35,7 @@ describe('backend crash', function () { }, function checkResponse (err, res) { 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); assert.ok(parsed.error); var msg = parsed.error[0]; @@ -51,7 +51,7 @@ describe('backend crash', function () { }, function checkResponse (err, res) { 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); assert.ok(parsed.error); var msg = parsed.error[0]; diff --git a/test/acceptance/batch/batch-drain-test.js b/test/acceptance/batch/batch-drain-test.js index 4db82299..17a923f7 100644 --- a/test/acceptance/batch/batch-drain-test.js +++ b/test/acceptance/batch/batch-drain-test.js @@ -66,14 +66,14 @@ describe('batch module', function () { if (err) { done(err); } - assert.equal(job.status, 'running'); + assert.strictEqual(job.status, 'running'); self.batch.drain(function () { jobBackend.get(job.job_id, function (err, job) { if (err) { done(err); } - assert.equal(job.status, 'pending'); + assert.strictEqual(job.status, 'pending'); done(); }); }); diff --git a/test/acceptance/batch/batch-limits-test.js b/test/acceptance/batch/batch-limits-test.js index 46644320..6c9c50f7 100644 --- a/test/acceptance/batch/batch-limits-test.js +++ b/test/acceptance/batch/batch-limits-test.js @@ -41,7 +41,7 @@ describe('batch query statement_timeout limit', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); assert.ok(job.failed_reason.match(/statement.*timeout/)); return done(); }); diff --git a/test/acceptance/batch/batch-multiquery-test.js b/test/acceptance/batch/batch-multiquery-test.js index b93d7aac..90e67b84 100644 --- a/test/acceptance/batch/batch-multiquery-test.js +++ b/test/acceptance/batch/batch-multiquery-test.js @@ -38,7 +38,7 @@ describe('batch multiquery', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); return done(); }); }); @@ -59,7 +59,7 @@ describe('batch multiquery', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); return done(); }); }); @@ -81,7 +81,7 @@ describe('batch multiquery', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); return done(); }); }); @@ -103,7 +103,7 @@ describe('batch multiquery', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); return done(); }); }); @@ -142,7 +142,7 @@ describe('batch multiquery', function () { } jobsCreated.forEach(function (job) { - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); }); return done(); @@ -185,7 +185,7 @@ describe('batch multiquery', function () { var statuses = jobsCreated.map(function (job) { return job.status; }); - assert.deepEqual(statuses, expectedStatus); + assert.deepStrictEqual(statuses, expectedStatus); return done(); }); @@ -227,7 +227,7 @@ describe('batch multiquery', function () { var statuses = jobsCreated.map(function (job) { return job.status; }); - assert.deepEqual(statuses, expectedStatus); + assert.deepStrictEqual(statuses, expectedStatus); return done(); }); diff --git a/test/acceptance/batch/batch-test.js b/test/acceptance/batch/batch-test.js index 256beb47..e6015a0a 100644 --- a/test/acceptance/batch/batch-test.js +++ b/test/acceptance/batch/batch-test.js @@ -32,7 +32,7 @@ describe('batch happy cases', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); return done(); }); }); @@ -50,7 +50,7 @@ describe('batch happy cases', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); return done(); }); }); @@ -66,7 +66,7 @@ describe('batch happy cases', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); return done(); }); }); @@ -100,7 +100,7 @@ describe('batch happy cases', function () { } jobsCreated.forEach(function (job) { - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); }); return done(); @@ -135,7 +135,7 @@ describe('batch happy cases', function () { } jobsCreated.forEach(function (job) { - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); }); return done(); @@ -154,7 +154,7 @@ describe('batch happy cases', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); return done(); }); }); @@ -172,7 +172,7 @@ describe('batch happy cases', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); return done(); }); }); @@ -190,7 +190,7 @@ describe('batch happy cases', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); return done(); }); }); diff --git a/test/acceptance/batch/job-callback-template-test.js b/test/acceptance/batch/job-callback-template-test.js index e77c4ea9..86005cf8 100644 --- a/test/acceptance/batch/job-callback-template-test.js +++ b/test/acceptance/batch/job-callback-template-test.js @@ -63,8 +63,8 @@ describe('Batch API callback templates', function () { if (err) { return done(err); } - assert.equal(rows[0].job_id, job.job_id); - assert.equal(rows[0].error_message, 'relation "invalid_table" does not exist'); + assert.strictEqual(rows[0].job_id, job.job_id); + assert.strictEqual(rows[0].error_message, 'relation "invalid_table" does not exist'); self.testClient.getResult('drop table test_batch_errors', done); }); }); @@ -117,7 +117,7 @@ describe('Batch API callback templates', function () { if (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); }); diff --git a/test/acceptance/batch/job-fallback-test.js b/test/acceptance/batch/job-fallback-test.js index 92f7d138..e0d2cadd 100644 --- a/test/acceptance/batch/job-fallback-test.js +++ b/test/acceptance/batch/job-fallback-test.js @@ -41,7 +41,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -74,7 +74,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -109,7 +109,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -144,7 +144,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -177,8 +177,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); - assert.equal(job.fallback_status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); + assert.strictEqual(job.fallback_status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -212,8 +212,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); - assert.equal(job.fallback_status, JobStatus.SKIPPED); + assert.strictEqual(job.status, JobStatus.FAILED); + assert.strictEqual(job.fallback_status, JobStatus.SKIPPED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -247,8 +247,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); - assert.equal(job.fallback_status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.FAILED); + assert.strictEqual(job.fallback_status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -281,8 +281,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); - assert.equal(job.fallback_status, JobStatus.SKIPPED); + assert.strictEqual(job.status, JobStatus.DONE); + assert.strictEqual(job.fallback_status, JobStatus.SKIPPED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -318,8 +318,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); - assert.equal(job.fallback_status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); + assert.strictEqual(job.fallback_status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -361,7 +361,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -404,7 +404,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -447,7 +447,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -489,7 +489,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -524,7 +524,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -558,7 +558,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -600,7 +600,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -643,7 +643,7 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -687,8 +687,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); - assert.equal(job.fallback_status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); + assert.strictEqual(job.fallback_status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -734,8 +734,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); - assert.equal(job.fallback_status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); + assert.strictEqual(job.fallback_status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -780,8 +780,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); - assert.equal(job.fallback_status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); + assert.strictEqual(job.fallback_status, JobStatus.FAILED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -830,8 +830,8 @@ describe('Batch API fallback job', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); - assert.equal(job.fallback_status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.FAILED); + assert.strictEqual(job.fallback_status, JobStatus.DONE); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -869,15 +869,15 @@ describe('Batch API fallback job', function () { return done(err); } - assert.equal(job.status, JobStatus.RUNNING); + assert.strictEqual(job.status, JobStatus.RUNNING); jobResult.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); - assert.equal(job.fallback_status, JobStatus.SKIPPED); + assert.strictEqual(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.fallback_status, JobStatus.SKIPPED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); @@ -915,15 +915,15 @@ describe('Batch API fallback job', function () { return done(err); } - assert.equal(job.status, JobStatus.RUNNING); + assert.strictEqual(job.status, JobStatus.RUNNING); jobResult.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); - assert.equal(job.fallback_status, JobStatus.SKIPPED); + assert.strictEqual(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.fallback_status, JobStatus.SKIPPED); jobResult.validateExpectedResponse(expectedQuery); return done(); }); diff --git a/test/acceptance/batch/job-query-limit-test.js b/test/acceptance/batch/job-query-limit-test.js index e50d73a0..b314d4f8 100644 --- a/test/acceptance/batch/job-query-limit-test.js +++ b/test/acceptance/batch/job-query-limit-test.js @@ -53,7 +53,7 @@ describe('job query limit', function () { status: 400 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { error: [expectedErrorMessage(queryTooLong)] }); + assert.deepStrictEqual(error, { error: [expectedErrorMessage(queryTooLong)] }); done(); }); }); @@ -88,7 +88,7 @@ describe('job query limit', function () { status: 400 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { error: [expectedErrorMessage(queries)] }); + assert.deepStrictEqual(error, { error: [expectedErrorMessage(queries)] }); done(); }); }); @@ -114,7 +114,7 @@ describe('job query limit', function () { status: 400 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { error: [expectedErrorMessage(fallbackQueries)] }); + assert.deepStrictEqual(error, { error: [expectedErrorMessage(fallbackQueries)] }); done(); }); }); diff --git a/test/acceptance/batch/job-query-order-test.js b/test/acceptance/batch/job-query-order-test.js index ba45074f..61758ff5 100644 --- a/test/acceptance/batch/job-query-order-test.js +++ b/test/acceptance/batch/job-query-order-test.js @@ -42,8 +42,8 @@ describe('job query order', function () { if (err) { return done(err); } - assert.equal(job1.status, JobStatus.DONE); - assert.equal(job2.status, JobStatus.DONE); + assert.strictEqual(job1.status, JobStatus.DONE); + assert.strictEqual(job2.status, JobStatus.DONE); assert.ok( new Date(job1.updated_at).getTime() < new Date(job2.updated_at).getTime(), 'job1 (' + job1.updated_at + ') should finish before job2 (' + job2.updated_at + ')' diff --git a/test/acceptance/batch/job-query-timeout-test.js b/test/acceptance/batch/job-query-timeout-test.js index d1a246a4..0d8a03fd 100644 --- a/test/acceptance/batch/job-query-timeout-test.js +++ b/test/acceptance/batch/job-query-timeout-test.js @@ -40,7 +40,7 @@ describe('job query timeout', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); done(); }); }); @@ -56,7 +56,7 @@ describe('job query timeout', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); done(); }); }); @@ -73,7 +73,7 @@ describe('job query timeout', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); done(); }); }); @@ -90,7 +90,7 @@ describe('job query timeout', function () { if (err) { return done(err); } - assert.equal(job.status, JobStatus.FAILED); + assert.strictEqual(job.status, JobStatus.FAILED); done(); }); }); diff --git a/test/acceptance/batch/job-test.js b/test/acceptance/batch/job-test.js index 32d3e171..a6503b79 100644 --- a/test/acceptance/batch/job-test.js +++ b/test/acceptance/batch/job-test.js @@ -40,10 +40,10 @@ describe('job module', function () { status: 201 }, function (err, res) { 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.equal(job.query, 'SELECT * FROM untitle_table_4'); - assert.equal(job.user, 'vizzuality'); + assert.strictEqual(job.query, 'SELECT * FROM untitle_table_4'); + assert.strictEqual(job.user, 'vizzuality'); done(); }); }); @@ -59,7 +59,7 @@ describe('job module', function () { status: 400 }, function (err, res) { 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(); }); }); @@ -76,7 +76,7 @@ describe('job module', function () { status: 400 }, function (err, res) { 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(); }); }); @@ -93,7 +93,7 @@ describe('job module', function () { status: 401 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { error: ['Unauthorized'] }); + assert.deepStrictEqual(error, { error: ['Unauthorized'] }); done(); }); }); @@ -110,7 +110,7 @@ describe('job module', function () { status: 404 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { + assert.deepStrictEqual(error, { error: [ 'Sorry, we can\'t find CARTO user \'wrong-host\'. ' + 'Please check that you have entered the correct domain.' @@ -129,9 +129,9 @@ describe('job module', function () { status: 200 }, function (err, res) { var jobGot = JSON.parse(res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.equal(jobGot.query, 'SELECT * FROM untitle_table_4'); - assert.equal(jobGot.user, 'vizzuality'); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.strictEqual(jobGot.query, 'SELECT * FROM untitle_table_4'); + assert.strictEqual(jobGot.user, 'vizzuality'); done(); }); }); @@ -145,7 +145,7 @@ describe('job module', function () { status: 401 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { error: ['Unauthorized'] }); + assert.deepStrictEqual(error, { error: ['Unauthorized'] }); done(); }); }); @@ -159,7 +159,7 @@ describe('job module', function () { status: 400 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { + assert.deepStrictEqual(error, { error: ['Job with id irrelevantJob not found'] }); done(); @@ -175,11 +175,11 @@ describe('job module', function () { status: 200 }, function (err, res) { var jobCancelled = JSON.parse(res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.equal(jobCancelled.job_id, job.job_id); - assert.equal(jobCancelled.query, 'SELECT * FROM untitle_table_4'); - assert.equal(jobCancelled.user, 'vizzuality'); - assert.equal(jobCancelled.status, 'cancelled'); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.strictEqual(jobCancelled.job_id, job.job_id); + assert.strictEqual(jobCancelled.query, 'SELECT * FROM untitle_table_4'); + assert.strictEqual(jobCancelled.user, 'vizzuality'); + assert.strictEqual(jobCancelled.status, 'cancelled'); done(); }); }); @@ -193,7 +193,7 @@ describe('job module', function () { status: 401 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { error: ['Unauthorized'] }); + assert.deepStrictEqual(error, { error: ['Unauthorized'] }); done(); }); }); @@ -207,7 +207,7 @@ describe('job module', function () { status: 404 }, function (err, res) { var error = JSON.parse(res.body); - assert.deepEqual(error, { + assert.deepStrictEqual(error, { error: [ 'Sorry, we can\'t find CARTO user \'wrong-host\'. ' + 'Please check that you have entered the correct domain.' diff --git a/test/acceptance/batch/leader-job-query-order-test.js b/test/acceptance/batch/leader-job-query-order-test.js index 1f6e224b..72e6e4a9 100644 --- a/test/acceptance/batch/leader-job-query-order-test.js +++ b/test/acceptance/batch/leader-job-query-order-test.js @@ -64,13 +64,13 @@ describe('multiple batch clients job query order', function () { if (err) { return done(err); } - assert.equal(job1.status, JobStatus.DONE); - assert.equal(job2.status, JobStatus.DONE); + assert.strictEqual(job1.status, JobStatus.DONE); + assert.strictEqual(job2.status, JobStatus.DONE); self.testClient.getResult('select * from ordered_inserts', function (err, rows) { assert.ok(!err); - assert.deepEqual(rows, [{ status: 1 }, { status: 2 }, { status: 3 }]); + assert.deepStrictEqual(rows, [{ status: 1 }, { status: 2 }, { status: 3 }]); assert.ok( new Date(job1.updated_at).getTime() < new Date(job2.updated_at).getTime(), 'job1 (' + job1.updated_at + ') should finish before job2 (' + job2.updated_at + ')' diff --git a/test/acceptance/batch/leader-multiple-users-query-order-test.js b/test/acceptance/batch/leader-multiple-users-query-order-test.js index 14e9ccb4..4dbfa85d 100644 --- a/test/acceptance/batch/leader-multiple-users-query-order-test.js +++ b/test/acceptance/batch/leader-multiple-users-query-order-test.js @@ -82,9 +82,9 @@ describe('multiple batch clients and users, job query order', function () { return done(err); } jobResultB1.getStatus(function (err, jobB1) { - assert.equal(jobA1.status, JobStatus.DONE); - assert.equal(jobA2.status, JobStatus.DONE); - assert.equal(jobB1.status, JobStatus.DONE); + assert.strictEqual(jobA1.status, JobStatus.DONE); + assert.strictEqual(jobA2.status, JobStatus.DONE); + assert.strictEqual(jobB1.status, JobStatus.DONE); assert.ok( 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 var expectedRows = [1, 2, 3].map(statusMapper); - assert.deepEqual(rows, expectedRows); + assert.deepStrictEqual(rows, expectedRows); var query = 'select * from ordered_inserts_bbbbb'; self.testClient.getResult(query, override, function (err, rows) { assert.ok(!err); var expectedRows = [1].map(statusMapper); - assert.deepEqual(rows, expectedRows); + assert.deepStrictEqual(rows, expectedRows); done(); }); diff --git a/test/acceptance/batch/queued-jobs-limit-test.js b/test/acceptance/batch/queued-jobs-limit-test.js index 4cc65e97..4c93987c 100644 --- a/test/acceptance/batch/queued-jobs-limit-test.js +++ b/test/acceptance/batch/queued-jobs-limit-test.js @@ -57,7 +57,7 @@ describe('max queued jobs', function () { createJob(self.server, 400, function (err, res) { 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'); done(); }); diff --git a/test/acceptance/batch/scheduler-basic-test.js b/test/acceptance/batch/scheduler-basic-test.js index 62c1e03b..64e09c12 100644 --- a/test/acceptance/batch/scheduler-basic-test.js +++ b/test/acceptance/batch/scheduler-basic-test.js @@ -70,8 +70,8 @@ describe('basic scheduling', function () { if (err) { return done(err); } - assert.equal(jobA1.status, JobStatus.DONE); - assert.equal(jobA2.status, JobStatus.DONE); + assert.strictEqual(jobA1.status, JobStatus.DONE); + assert.strictEqual(jobA2.status, JobStatus.DONE); assert.ok( 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 var expectedRows = [1, 2, 3].map(statusMapper); - assert.deepEqual(rows, expectedRows); + assert.deepStrictEqual(rows, expectedRows); return done(); }); diff --git a/test/acceptance/batch/use-cases-test.js b/test/acceptance/batch/use-cases-test.js index 19e47546..a8c93cc9 100644 --- a/test/acceptance/batch/use-cases-test.js +++ b/test/acceptance/batch/use-cases-test.js @@ -30,10 +30,10 @@ describe('Use cases', function () { return done(err); } - assert.equal(job.status, JobStatus.DONE); + assert.strictEqual(job.status, JobStatus.DONE); 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(); }); }); @@ -55,17 +55,17 @@ describe('Use cases', function () { return done(err); } - assert.equal(job.status, JobStatus.RUNNING); + assert.strictEqual(job.status, JobStatus.RUNNING); jobResult.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.status, JobStatus.CANCELLED); 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(); }); }); @@ -98,21 +98,21 @@ describe('Use cases', function () { return done(err); } - assert.equal(job.status, JobStatus.PENDING); + assert.strictEqual(job.status, JobStatus.PENDING); jobResult2.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.status, JobStatus.CANCELLED); jobResult1.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.status, JobStatus.CANCELLED); done(); }); }); @@ -136,14 +136,14 @@ describe('Use cases', function () { return done(err); } - assert.equal(job.status, JobStatus.RUNNING); + assert.strictEqual(job.status, JobStatus.RUNNING); jobResult.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.status, JobStatus.CANCELLED); done(); }); }); @@ -169,17 +169,17 @@ describe('Use cases', function () { return done(err); } - assert.equal(job.status, JobStatus.RUNNING); + assert.strictEqual(job.status, JobStatus.RUNNING); jobResult.cancel(function (err, job) { if (err) { return done(err); } - assert.equal(job.status, JobStatus.CANCELLED); + assert.strictEqual(job.status, JobStatus.CANCELLED); 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(); }); }); diff --git a/test/acceptance/cache-headers-test.js b/test/acceptance/cache-headers-test.js index 21d4d379..dd994df8 100644 --- a/test/acceptance/cache-headers-test.js +++ b/test/acceptance/cache-headers-test.js @@ -18,7 +18,7 @@ describe('cache headers', function () { }, {}, function (err, res) { - assert.equal(res.headers.vary, 'Authorization'); + assert.strictEqual(res.headers.vary, 'Authorization'); done(); }); }); @@ -42,7 +42,7 @@ describe('cache headers', function () { }, {}, 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, { url: `/api/v1/sql?${qs.encode({ @@ -72,7 +72,7 @@ describe('cache headers', function () { method: 'GET' }, {}, 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, { url: `/api/v1/sql?${qs.encode({ @@ -85,7 +85,7 @@ describe('cache headers', function () { method: 'GET' }, {}, 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(); }); }); @@ -109,7 +109,7 @@ describe('cache headers', function () { }, {}, 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(); }); }); diff --git a/test/acceptance/copy-abort-test.js b/test/acceptance/copy-abort-test.js index 64d4f49a..17fe9494 100644 --- a/test/acceptance/copy-abort-test.js +++ b/test/acceptance/copy-abort-test.js @@ -40,7 +40,7 @@ function countInsertedRows (host, port, callback) { return callback(err); } - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); const result = JSON.parse(body); callback(null, result); }); @@ -88,7 +88,7 @@ describe('Cancel "copy to" commands', function () { return done(err); } - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); done(); }); @@ -110,7 +110,7 @@ describe('Cancel "copy to" commands', function () { return done(err); } - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); done(); }); @@ -141,7 +141,7 @@ describe('Cancel "copy to" commands', function () { return done(err); } - assert.equal(result.rows[0].count, 1); + assert.strictEqual(result.rows[0].count, 1); done(); }); @@ -169,7 +169,7 @@ describe('Cancel "copy to" commands', function () { return done(err); } - assert.equal(result.rows[0].count, 1); + assert.strictEqual(result.rows[0].count, 1); done(); }); @@ -203,7 +203,7 @@ describe('Cancel "copy to" commands', function () { return done(err); } - assert.equal(result.rows[0].count, 1); + assert.strictEqual(result.rows[0].count, 1); done(); }); @@ -231,7 +231,7 @@ describe('Cancel "copy to" commands', function () { return done(err); } - assert.equal(result.rows[0].count, 1); + assert.strictEqual(result.rows[0].count, 1); done(); }); diff --git a/test/acceptance/copy-endpoints-test.js b/test/acceptance/copy-endpoints-test.js index f487511d..3670a2a8 100644 --- a/test/acceptance/copy-endpoints-test.js +++ b/test/acceptance/copy-endpoints-test.js @@ -72,7 +72,7 @@ describe('copy-endpoints', function () { }, {}, function (err, res) { assert.ifError(err); const response = JSON.parse(res.body); - assert.equal(!!response.time, true); + assert.strictEqual(!!response.time, true); assert.strictEqual(response.total_rows, 2016); done(); }); @@ -88,7 +88,7 @@ describe('copy-endpoints', function () { method: 'POST' }, {}, function (err, res) { assert.ifError(err); - assert.deepEqual( + assert.deepStrictEqual( JSON.parse(res.body), { error: ['relation \"unexisting_table\" does not exist'] @@ -107,7 +107,7 @@ describe('copy-endpoints', function () { method: 'POST' }, {}, function (err, res) { assert.ifError(err); - assert.deepEqual( + assert.deepStrictEqual( JSON.parse(res.body), { error: ['No rows copied'] @@ -125,7 +125,7 @@ describe('copy-endpoints', function () { method: 'POST' }, {}, function (err, res) { assert.ifError(err); - assert.deepEqual( + assert.deepStrictEqual( JSON.parse(res.body), { 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; assert.ok(res.body.match(regex)); - assert.equal(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp'); - assert.equal(res.headers['content-type'], 'application/octet-stream'); + assert.strictEqual(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp'); + assert.strictEqual(res.headers['content-type'], 'application/octet-stream'); 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; assert.ok(res.body.match(regex)); - assert.equal(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp'); - assert.equal(res.headers['content-type'], 'application/octet-stream'); + assert.strictEqual(res.headers['content-disposition'], 'attachment; filename=%2Ftmp%2Foutput.dmp'); + assert.strictEqual(res.headers['content-type'], 'application/octet-stream'); done(); }); @@ -212,7 +212,7 @@ describe('copy-endpoints', function () { method: 'GET' }, {}, function (err, res) { assert.ifError(err); - assert.deepEqual( + assert.deepStrictEqual( JSON.parse(res.body), { error: ['SQL is missing'] @@ -236,7 +236,7 @@ describe('copy-endpoints', function () { }, {}, function (err, res) { assert.ifError(err); const response = JSON.parse(res.body); - assert.equal(!!response.time, true); + assert.strictEqual(!!response.time, true); assert.strictEqual(response.total_rows, 6); done(); }); @@ -255,7 +255,7 @@ describe('copy-endpoints', function () { method: 'POST' }, {}, function (err, res) { assert.ifError(err); - assert.deepEqual( + assert.deepStrictEqual( JSON.parse(res.body), { error: ['Error while gunzipping: incorrect header check'] @@ -292,7 +292,7 @@ describe('copy-endpoints', function () { }, function (err, res) { assert.ifError(err); - assert.deepEqual(JSON.parse(res.body), { + assert.deepStrictEqual(JSON.parse(res.body), { error: [ 'You are over platform\'s limits: SQL query timeout error.' + ' Refactor your query before running again or contact CARTO support for more details.' @@ -321,7 +321,7 @@ describe('copy-endpoints', function () { detail: 'datasource' }; 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(); }); }); @@ -572,7 +572,7 @@ describe('copy-endpoints', function () { headers: { 'Content-Type': 'application/json; charset=utf-8' } }, function (err, res) { 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); }); @@ -623,7 +623,7 @@ describe('copy-endpoints', function () { headers: { 'Content-Type': 'application/json; charset=utf-8' } }, function (err, res) { 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); }); diff --git a/test/acceptance/copy-statements-test.js b/test/acceptance/copy-statements-test.js index 2ea1154a..73718289 100644 --- a/test/acceptance/copy-statements-test.js +++ b/test/acceptance/copy-statements-test.js @@ -45,10 +45,10 @@ describe('copy-statements', function () { method: 'GET' }, {}, function (err, res) { // We expect a problem, actually - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.deepEqual(JSON.parse(res.body), { error: ['COPY from stdin failed: No source stream defined'] }); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.deepStrictEqual(JSON.parse(res.body), { error: ['COPY from stdin failed: No source stream defined'] }); done(); }); }); @@ -63,9 +63,9 @@ describe('copy-statements', function () { method: 'GET' }, {}, function (err, res) { // We expect a problem, actually - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); 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./; assert.ok(JSON.parse(res.body).error[0].match(error_exp)); diff --git a/test/acceptance/copy-throttle-test.js b/test/acceptance/copy-throttle-test.js index 624dbd5a..950d3e8d 100644 --- a/test/acceptance/copy-throttle-test.js +++ b/test/acceptance/copy-throttle-test.js @@ -80,7 +80,7 @@ describe('COPY FROM throttle', function () { return done(err); } - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); done(); }); @@ -130,9 +130,9 @@ describe('COPY FROM throttle', function () { return done(err); } - assert.equal(res.statusCode, 400); + assert.strictEqual(res.statusCode, 400); 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(); }); @@ -157,7 +157,7 @@ describe('COPY FROM throttle', function () { if (err) { return done(err); } - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); done(); }); diff --git a/test/acceptance/export/arraybuffer-test.js b/test/acceptance/export/arraybuffer-test.js index 736f48a7..fc3c8f38 100644 --- a/test/acceptance/export/arraybuffer-test.js +++ b/test/acceptance/export/arraybuffer-test.js @@ -17,8 +17,8 @@ describe('export.arraybuffer', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); - assert.equal(res.headers['content-type'], 'application/octet-stream'); + assert.strictEqual(res.statusCode, 200, res.body); + assert.strictEqual(res.headers['content-type'], 'application/octet-stream'); done(); }); }); @@ -32,9 +32,9 @@ describe('export.arraybuffer', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.body); + assert.strictEqual(res.statusCode, 400, 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(); }); diff --git a/test/acceptance/export/csv-test.js b/test/acceptance/export/csv-test.js index f8e61681..0e21af4d 100644 --- a/test/acceptance/export/csv-test.js +++ b/test/acceptance/export/csv-test.js @@ -17,19 +17,19 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.csv/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.csv/gi.test(cd)); 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 row0 = rows[0].split(','); var row1 = rows[1].split(','); - assert.equal(row0[2], 'created_at'); - assert.equal(row1[2], '2011-09-21 14:02:21.314252'); + assert.strictEqual(row0[2], 'created_at'); + assert.strictEqual(row1[2], '2011-09-21 14:02:21.314252'); done(); }); @@ -57,12 +57,12 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.csv/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.csv/gi.test(cd)); 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(); }); }); @@ -73,12 +73,12 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd); - assert.equal(true, /filename=mycsv.csv/gi.test(cd), cd); + assert.strictEqual(true, /^attachment/.test(cd), 'CSV is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=mycsv.csv/gi.test(cd), cd); 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 checkFields = { name: true, cartodb_id: true, the_geom: true, the_geom_webmercator: true }; Object.keys(checkFields).forEach(function (f) { @@ -100,7 +100,7 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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 checkFields = { name: true, cartodb_id: false, the_geom: true, the_geom_webmercator: true }; Object.keys(checkFields).forEach(function (f) { @@ -122,7 +122,7 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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/)); done(); }); @@ -135,7 +135,7 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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'); assert.ok(obtained_lines.length <= 2, // may or may not have an header // See http://trac.osgeo.org/gdal/ticket/5234 @@ -150,7 +150,7 @@ describe('export.csv', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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/)); done(); }); @@ -196,7 +196,7 @@ describe('export.csv', function () { }, function (err, res) { var headersPlusExtraLine = 2; - assert.equal(res.body.split('\n').length, limit + headersPlusExtraLine); + assert.strictEqual(res.body.split('\n').length, limit + headersPlusExtraLine); done(); } ); diff --git a/test/acceptance/export/geojson-test.js b/test/acceptance/export/geojson-test.js index bdaeed3f..e255060a 100644 --- a/test/acceptance/export/geojson-test.js +++ b/test/acceptance/export/geojson-test.js @@ -25,10 +25,10 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd)); done(); }); }); @@ -40,10 +40,10 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd)); done(); }); }); @@ -54,9 +54,9 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); 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(); }); }); @@ -67,9 +67,9 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); 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(); }); }); @@ -80,7 +80,7 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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 row0 = parsed_body.features[0].properties; 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' }, method: 'GET' }, { }, 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 row0 = parsed_body.features[0].properties; 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' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, 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(); }); }); @@ -142,9 +142,9 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, 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(); }); }); @@ -158,10 +158,10 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.geojson/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'GEOJSON is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.geojson/gi.test(cd)); var gjson = JSON.parse(res.body); var expected = { type: 'FeatureCollection', @@ -171,7 +171,7 @@ describe('export.geojson', function () { geometry: null }] }; - assert.deepEqual(gjson, expected); + assert.deepStrictEqual(gjson, expected); done(); }); }); @@ -185,10 +185,10 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.body); + assert.strictEqual(res.statusCode, 400, res.body); var geoJson = JSON.parse(res.body); 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.*/)); done(); }); @@ -203,10 +203,10 @@ describe('export.geojson', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var geoJson = JSON.parse(res.body); var expectedGeoJson = { type: 'FeatureCollection', features: [] }; - assert.deepEqual(geoJson, expectedGeoJson); + assert.deepStrictEqual(geoJson, expectedGeoJson); done(); }); }); diff --git a/test/acceptance/export/geopackage-test.js b/test/acceptance/export/geopackage-test.js index 97ab7eee..1f105e61 100644 --- a/test/acceptance/export/geopackage-test.js +++ b/test/acceptance/export/geopackage-test.js @@ -18,12 +18,12 @@ describe('geopackage query', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); - assert.equal(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8'); + assert.strictEqual(res.statusCode, 200, res.body); + assert.strictEqual(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8'); assert.notEqual(res.headers['content-disposition'].indexOf(table_name + '.gpkg'), -1); var db = new sqlite.Database(':memory:', res.body); var qr = db.get('PRAGMA database_list', function (err) { - assert.equal(err, null); + assert.strictEqual(err, null); done(); }); assert.notEqual(qr, undefined); @@ -52,24 +52,24 @@ describe('geopackage query', function () { db.serialize(function () { var schemaQuery = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"; var sqr = db.get(schemaQuery, function (err, row) { - assert.equal(err, null); - assert.equal(row.name, table_name); + assert.strictEqual(err, null); + assert.strictEqual(row.name, table_name); }); assert.notEqual(sqr, undefined); var gpkgQuery = 'SELECT table_name FROM gpkg_contents'; var gqr = db.get(gpkgQuery, function (err, row) { - assert.equal(row.table_name, table_name); - assert.equal(err, null); + assert.strictEqual(row.table_name, table_name); + assert.strictEqual(err, null); }); assert.notEqual(gqr, undefined); var dataQuery = 'SELECT * FROM ' + table_name + ' order by cartodb_id'; var dqr = db.get(dataQuery, function (err, row) { - assert.equal(err, null); - assert.equal(row.cartodb_id, 1); - assert.equal(row.name, 'Hawai'); - assert.equal(row.fid, undefined); + assert.strictEqual(err, null); + assert.strictEqual(row.cartodb_id, 1); + assert.strictEqual(row.name, 'Hawai'); + assert.strictEqual(row.fid, undefined); done(); }); assert.notEqual(dqr, undefined); diff --git a/test/acceptance/export/kml-test.js b/test/acceptance/export/kml-test.js index dd2a6913..9528774e 100644 --- a/test/acceptance/export/kml-test.js +++ b/test/acceptance/export/kml-test.js @@ -7,7 +7,7 @@ var assert = require('../../support/assert'); var querystring = require('querystring'); var libxmljs = require('libxmljs'); -describe('export.kml', function () { +describe.only('export.kml', function () { // Check if an attribute is in the KML output // // NOTE: "name" and "description" attributes are threated specially @@ -107,10 +107,11 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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']; - assert.equal(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, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd); var row0 = res.body; var checkfields = { Name: 1, address: 1, cartodb_id: 1, the_geom: 0, the_geom_webmercator: 0 }; 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' }, method: 'POST' }, { }, 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']; - assert.equal(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, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd); done(); }); }); @@ -149,10 +151,11 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, 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']; - assert.equal(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, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + 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); done(); }); @@ -164,10 +167,11 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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']; - assert.equal(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, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd); var row0 = res.body; var checkFields = { Name: 1, address: 0, cartodb_id: 0, the_geom: 0, the_geom_webmercator: 0 }; Object.keys(checkFields).forEach(function (f) { @@ -187,12 +191,13 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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']; - assert.equal(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, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=kmltest.kml/gi.test(cd), 'Unexpected KML filename: ' + cd); var name = extractFolderName(res.body); - assert.equal(name, 'kmltest'); + assert.strictEqual(name, 'kmltest'); done(); }); }); @@ -203,9 +208,10 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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']; - 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(); }); }); @@ -222,14 +228,14 @@ describe('export.kml', function () { var waiting = concurrency; function validate (err, res) { - // console.log("Response ended"); - assert.equal(res.statusCode, 200, res.body); + assert.ifError(err); + assert.strictEqual(res.statusCode, 200, res.body); assert.ok(res.body); var snippet = res.body.substr(0, 5); - assert.equal(snippet, '' + '' + @@ -277,7 +283,8 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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 var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?>' + '' + @@ -300,10 +307,11 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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); assert(coords, 'No coordinates in ' + res.body); - assert.deepEqual(coords, [[33, 16]]); + assert.deepStrictEqual(coords, [['33', '16']]); done(); }); }); @@ -319,10 +327,11 @@ describe('export.kml', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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); assert(coords, 'No coordinates in ' + res.body); - assert.deepEqual(coords, [[33, 16]]); + assert.deepStrictEqual(coords, [['33', '16']]); done(); }); }); @@ -343,7 +352,8 @@ describe('export.kml', function () { status: 200 }, function (err, res) { - assert.equal(res.body.match(//g).length, limit); + assert.ifError(err); + assert.strictEqual(res.body.match(//g).length, limit); done(); } ); @@ -363,7 +373,8 @@ describe('export.kml', function () { status: 200 }, function (err, res) { - assert.equal(res.body.match(//g).length, limit); + assert.ifError(err); + assert.strictEqual(res.body.match(//g).length, limit); done(); } ); @@ -387,7 +398,8 @@ describe('export.kml', function () { status: 200 }, function (err, res) { - assert.equal(res.body.match(//g), null); + assert.ifError(err); + assert.strictEqual(res.body.match(//g), null); done(); } ); diff --git a/test/acceptance/export/shapefile-test.js b/test/acceptance/export/shapefile-test.js index 8ddf561c..ad17411f 100644 --- a/test/acceptance/export/shapefile-test.js +++ b/test/acceptance/export/shapefile-test.js @@ -20,10 +20,10 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.zip/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd)); var tmpfile = '/tmp/myshape.zip'; var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -47,10 +47,10 @@ describe('export.shapefile', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(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, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd); done(); }); }); @@ -65,10 +65,10 @@ describe('export.shapefile', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(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, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + 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); done(); }); @@ -81,10 +81,10 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); - assert.equal(true, /filename=myshape.zip/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=myshape.zip/gi.test(cd)); var tmpfile = '/tmp/myshape.zip'; var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -107,11 +107,11 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var fname = 'b_______a'; var cd = res.headers['content-disposition']; - assert.equal(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, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=b_______a.zip/gi.test(cd), 'Unexpected SHP filename: ' + cd); var tmpfile = '/tmp/myshape.zip'; var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -134,9 +134,9 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); 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 writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -166,7 +166,7 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var tmpfile = '/tmp/myshape.zip'; var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -193,9 +193,9 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); var parsedBody = JSON.parse(res.body); var error = parsedBody.error[0]; var expectedError = /Attempt to write non-point \(LINESTRING\) geometry to point shapefile/g; @@ -219,9 +219,9 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); var parsedBody = JSON.parse(res.body); var error = parsedBody.error[0]; var expectedError = /Attempt to write non-point \(LINESTRING\) geometry to point shapefile/g; @@ -243,7 +243,7 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var tmpfile = '/tmp/myshape.zip'; var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -263,8 +263,8 @@ describe('export.shapefile', function () { var waiting = concurrency; function validate (err, res) { var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.zip/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'SHP is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.zip/gi.test(cd)); var tmpfile = '/tmp/myshape.zip'; var writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -310,9 +310,9 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); 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 writeErr = fs.writeFileSync(tmpfile, res.body, 'binary'); if (writeErr) { @@ -371,7 +371,7 @@ describe('export.shapefile', function () { if (err) { return done(err); } - assert.equal(collection.features.length, limit); + assert.strictEqual(collection.features.length, limit); done(); }); } @@ -391,10 +391,10 @@ describe('export.shapefile', function () { encoding: 'binary', method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.body); + assert.strictEqual(res.statusCode, 400, res.body); var parsedBody = JSON.parse(res.body); 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(); }); }); diff --git a/test/acceptance/export/spatialite-test.js b/test/acceptance/export/spatialite-test.js index 22cf5f6e..6220d0f7 100644 --- a/test/acceptance/export/spatialite-test.js +++ b/test/acceptance/export/spatialite-test.js @@ -13,11 +13,11 @@ describe('spatialite query', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); - assert.equal(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8'); + assert.strictEqual(res.statusCode, 200, res.body); + assert.strictEqual(res.headers['content-type'], 'application/x-sqlite3; charset=utf-8'); var db = new sqlite.Database(':memory:', res.body); var qr = db.get('PRAGMA database_list', function (err) { - assert.equal(err, null); + assert.strictEqual(err, null); done(); }); assert.notEqual(qr, undefined); @@ -30,7 +30,7 @@ describe('spatialite query', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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); done(); }); @@ -45,7 +45,7 @@ describe('spatialite query', function () { var db = new sqlite.Database(':memory:', res.body); var schemaQuery = "SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name"; var qr = db.get(schemaQuery, function (err) { - assert.equal(err, null); + assert.strictEqual(err, null); done(); }); assert.notEqual(qr, undefined); diff --git a/test/acceptance/export/svg-test.js b/test/acceptance/export/svg-test.js index ad5ac7d7..19ba33fa 100644 --- a/test/acceptance/export/svg-test.js +++ b/test/acceptance/export/svg-test.js @@ -17,10 +17,10 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; 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('') > 0, res.body); // TODO: test viewBox done(); @@ -38,11 +38,11 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); 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.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('') > 0, res.body); // TODO: test viewBox done(); @@ -60,10 +60,10 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; 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('') > 0, res.body); // TODO: test viewBox done(); @@ -80,10 +80,10 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; 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); // TODO: test viewBox // TODO: test radius @@ -102,10 +102,10 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); var cd = res.headers['content-disposition']; 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('') > 0, res.body); // TODO: test viewBox @@ -115,11 +115,11 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { - assert.equal(res.statusCode, 200, res.body); + assert.strictEqual(res.statusCode, 200, res.body); 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.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('') > 0, res.body); // TODO: test viewBox done(); @@ -140,10 +140,10 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); - assert.deepEqual(res.headers['content-disposition'], 'inline'); - assert.deepEqual(JSON.parse(res.body), { + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); + assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); + assert.deepStrictEqual(JSON.parse(res.body), { error: ['column "the_geom" does not exist'] }); done(); @@ -160,8 +160,8 @@ describe('export.svg', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.deepEqual(JSON.parse(res.body), { + assert.strictEqual(res.statusCode, 400, res.statusCode + ': ' + res.body); + assert.deepStrictEqual(JSON.parse(res.body), { error: ['column "the_geom" does not exist'] }); done(); @@ -186,8 +186,8 @@ describe('export.svg', function () { }, function (err, res) { var parsedBody = JSON.parse(res.body); - assert.deepEqual(Object.keys(parsedBody), ['error']); - assert.deepEqual(parsedBody.error, ['division by zero']); + assert.deepStrictEqual(Object.keys(parsedBody), ['error']); + assert.deepStrictEqual(parsedBody.error, ['division by zero']); done(); } ); diff --git a/test/acceptance/export/timeout-test.js b/test/acceptance/export/timeout-test.js index 827ab636..162aed72 100644 --- a/test/acceptance/export/timeout-test.js +++ b/test/acceptance/export/timeout-test.js @@ -102,7 +102,7 @@ describe('timeout', function () { this.testClient.getResult(scenario.query, override, (err, res) => { assert.ifError(err); - assert.deepEqual(res, { + assert.deepStrictEqual(res, { error: [ 'You are over platform\'s limits: SQL query timeout error.' + ' 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) => { assert.ifError(err); - assert.deepEqual(res, { + assert.deepStrictEqual(res, { error: [ 'You are over platform\'s limits: SQL query timeout error.' + ' Refactor your query before running again or contact CARTO support for more details.' diff --git a/test/acceptance/export/topojson-test.js b/test/acceptance/export/topojson-test.js index 6b91245e..a07f9ef8 100644 --- a/test/acceptance/export/topojson-test.js +++ b/test/acceptance/export/topojson-test.js @@ -37,25 +37,25 @@ describe('export.topojson', function () { }, function (err, res) { var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.topojson/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.topojson/gi.test(cd)); var topojson = JSON.parse(res.body); - assert.equal(topojson.type, 'Topology'); + assert.strictEqual(topojson.type, 'Topology'); // Check transform assert.ok(topojson.hasOwnProperty('transform')); var trans = topojson.transform; - assert.equal(_.keys(trans).length, 2); // only scale and translate - assert.equal(trans.scale.length, 2); // scalex, scaley - assert.equal(Math.round(trans.scale[0] * 1e6), 1000); - assert.equal(Math.round(trans.scale[1] * 1e6), 1000); - assert.equal(trans.translate.length, 2); // translatex, translatey - assert.equal(trans.translate[0], -5); - assert.equal(trans.translate[1], -5); + assert.strictEqual(_.keys(trans).length, 2); // only scale and translate + assert.strictEqual(trans.scale.length, 2); // scalex, scaley + assert.strictEqual(Math.round(trans.scale[0] * 1e6), 1000); + assert.strictEqual(Math.round(trans.scale[1] * 1e6), 1000); + assert.strictEqual(trans.translate.length, 2); // translatex, translatey + assert.strictEqual(trans.translate[0], -5); + assert.strictEqual(trans.translate[1], -5); // Check 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]; // console.dir(obj); @@ -63,17 +63,17 @@ describe('export.topojson', function () { // { type: 'Polygon', // arcs: [ [ 0, 1 ] ], // properties: { gid: 1, nam: 'U' } } - assert.equal(_.keys(obj).length, 3); // type, arcs, properties - assert.equal(obj.type, 'Polygon'); - assert.equal(obj.arcs.length, 1); /* only shell, no holes */ + assert.strictEqual(_.keys(obj).length, 3); // type, arcs, properties + assert.strictEqual(obj.type, 'Polygon'); + assert.strictEqual(obj.arcs.length, 1); /* only shell, no holes */ var shell = obj.arcs[0]; - assert.equal(shell.length, 2); /* one shared arc, one non-shared */ - assert.equal(shell[0], 0); /* shared arc */ - assert.equal(shell[1], 1); /* non-shared arc */ + assert.strictEqual(shell.length, 2); /* one shared arc, one non-shared */ + assert.strictEqual(shell[0], 0); /* shared arc */ + assert.strictEqual(shell[1], 1); /* non-shared arc */ var props = obj.properties; - assert.equal(_.keys(props).length, 2); // gid, name - assert.equal(props.gid, 1); - assert.equal(props.name, 'U'); + assert.strictEqual(_.keys(props).length, 2); // gid, name + assert.strictEqual(props.gid, 1); + assert.strictEqual(props.name, 'U'); obj = topojson.objects[1]; // console.dir(obj); @@ -81,51 +81,51 @@ describe('export.topojson', function () { // { type: 'Polygon', // arcs: [ [ 0, 2 ] ], // properties: { gid: 2, nam: 'D' } } - assert.equal(_.keys(obj).length, 3); // type, arcs, properties - assert.equal(obj.type, 'Polygon'); - assert.equal(obj.arcs.length, 1); /* only shell, no holes */ + assert.strictEqual(_.keys(obj).length, 3); // type, arcs, properties + assert.strictEqual(obj.type, 'Polygon'); + assert.strictEqual(obj.arcs.length, 1); /* only shell, no holes */ shell = obj.arcs[0]; - assert.equal(shell.length, 2); /* one shared arc, one non-shared */ - assert.equal(shell[0], 0); /* shared arc */ - assert.equal(shell[1], 2); /* non-shared arc */ + assert.strictEqual(shell.length, 2); /* one shared arc, one non-shared */ + assert.strictEqual(shell[0], 0); /* shared arc */ + assert.strictEqual(shell[1], 2); /* non-shared arc */ props = obj.properties; - assert.equal(_.keys(props).length, 2); // gid, name - assert.equal(props.gid, 2); - assert.equal(props.name, 'D'); + assert.strictEqual(_.keys(props).length, 2); // gid, name + assert.strictEqual(props.gid, 2); + assert.strictEqual(props.name, 'D'); // Check 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 - assert.equal(arc.length, 2); // shared arc has two vertices + assert.strictEqual(arc.length, 2); // shared arc has two vertices var p = arc[0]; - assert.equal(Math.round(p[0] * trans.scale[0]), 0); - assert.equal(Math.round(p[1] * trans.scale[1]), 5); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), 0); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), 5); p = arc[1]; - assert.equal(Math.round(p[0] * trans.scale[0]), 5); - assert.equal(Math.round(p[1] * trans.scale[1]), 5); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), 5); 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]; - assert.equal(Math.round(p[0] * trans.scale[0]), 5); - assert.equal(Math.round(p[1] * trans.scale[1]), 10); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), 10); p = arc[1]; - assert.equal(Math.round(p[0] * trans.scale[0]), 5); - assert.equal(Math.round(p[1] * trans.scale[1]), -5); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), -5); p = arc[2]; - assert.equal(Math.round(p[0] * trans.scale[0]), -10); - assert.equal(Math.round(p[1] * trans.scale[1]), 0); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), -10); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), 0); 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]; - assert.equal(Math.round(p[0] * trans.scale[0]), 5); - assert.equal(Math.round(p[1] * trans.scale[1]), 10); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), 5); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), 10); p = arc[1]; - assert.equal(Math.round(p[0] * trans.scale[0]), 0); - assert.equal(Math.round(p[1] * trans.scale[1]), -10); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), 0); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), -10); p = arc[2]; - assert.equal(Math.round(p[0] * trans.scale[0]), -5); - assert.equal(Math.round(p[1] * trans.scale[1]), 5); + assert.strictEqual(Math.round(p[0] * trans.scale[0]), -5); + assert.strictEqual(Math.round(p[1] * trans.scale[1]), 5); done(); }); @@ -142,25 +142,25 @@ describe('export.topojson', function () { }, function (err, res) { var cd = res.headers['content-disposition']; - assert.equal(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd); - assert.equal(true, /filename=cartodb-query.topojson/gi.test(cd)); + assert.strictEqual(true, /^attachment/.test(cd), 'TOPOJSON is not disposed as attachment: ' + cd); + assert.strictEqual(true, /filename=cartodb-query.topojson/gi.test(cd)); var topojson = JSON.parse(res.body); - assert.equal(topojson.type, 'Topology'); + assert.strictEqual(topojson.type, 'Topology'); // Check transform assert.ok(topojson.hasOwnProperty('transform')); var trans = topojson.transform; - assert.equal(_.keys(trans).length, 2); // only scale and translate - assert.equal(trans.scale.length, 2); // scalex, scaley - assert.equal(Math.round(trans.scale[0] * 1e6), 1000); - assert.equal(Math.round(trans.scale[1] * 1e6), 500); - assert.equal(trans.translate.length, 2); // translatex, translatey - assert.equal(trans.translate[0], -5); - assert.equal(trans.translate[1], 0); + assert.strictEqual(_.keys(trans).length, 2); // only scale and translate + assert.strictEqual(trans.scale.length, 2); // scalex, scaley + assert.strictEqual(Math.round(trans.scale[0] * 1e6), 1000); + assert.strictEqual(Math.round(trans.scale[1] * 1e6), 500); + assert.strictEqual(trans.translate.length, 2); // translatex, translatey + assert.strictEqual(trans.translate[0], -5); + assert.strictEqual(trans.translate[1], 0); // Check 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]; // console.dir(obj); @@ -168,22 +168,22 @@ describe('export.topojson', function () { // { type: 'Polygon', // arcs: [ [ 0, 1 ] ], // properties: { gid: 1, nam: 'U' } } - assert.equal(_.keys(obj).length, 3); // type, arcs, properties - assert.equal(obj.type, 'Polygon'); - assert.equal(obj.arcs.length, 1); /* only shell, no holes */ + assert.strictEqual(_.keys(obj).length, 3); // type, arcs, properties + assert.strictEqual(obj.type, 'Polygon'); + assert.strictEqual(obj.arcs.length, 1); /* only shell, no holes */ var shell = obj.arcs[0]; - assert.equal(shell.length, 1); /* one non shared arc */ - assert.equal(shell[0], 0); /* non-shared arc */ + assert.strictEqual(shell.length, 1); /* one non shared arc */ + assert.strictEqual(shell[0], 0); /* non-shared arc */ var props = obj.properties; - assert.equal(_.keys(props).length, 2); // gid, name - assert.equal(props.gid, 1); - assert.equal(props.name, 'U'); + assert.strictEqual(_.keys(props).length, 2); // gid, name + assert.strictEqual(props.gid, 1); + assert.strictEqual(props.name, 'U'); // Check arcs assert.ok(topojson.hasOwnProperty('arcs')); - assert.equal(topojson.arcs.length, 1); + assert.strictEqual(topojson.arcs.length, 1); 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(); }); @@ -202,7 +202,7 @@ describe('export.topojson', function () { }, function (err, res) { 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); done(); } @@ -222,7 +222,7 @@ describe('export.topojson', function () { status: 200 }, function (err, res) { - assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); + assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); var didRunJsonCallback = false; // jshint ignore:start function foo_jsonp (body) { @@ -254,8 +254,8 @@ describe('export.topojson', function () { }, function (err, res) { var parsedBody = JSON.parse(res.body); - assert.deepEqual(Object.keys(parsedBody), ['error']); - assert.deepEqual(parsedBody.error, ['division by zero']); + assert.deepStrictEqual(Object.keys(parsedBody), ['error']); + assert.deepStrictEqual(parsedBody.error, ['division by zero']); done(); } ); diff --git a/test/acceptance/handle-query-test.js b/test/acceptance/handle-query-test.js index c2474c28..8339c715 100644 --- a/test/acceptance/handle-query-test.js +++ b/test/acceptance/handle-query-test.js @@ -30,7 +30,7 @@ describe('Handle query middleware', function () { assert.ok(!err); 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(); } @@ -54,8 +54,8 @@ describe('Handle query middleware', function () { assert.ok(!err); const response = JSON.parse(res.body); - assert.equal(response.rows.length, 1); - assert.equal(response.rows[0].foo, 14); + assert.strictEqual(response.rows.length, 1); + assert.strictEqual(response.rows[0].foo, 14); return done(); } @@ -81,8 +81,8 @@ describe('Handle query middleware', function () { jobResult.getStatus(function (err, job) { assert.ok(!err); - assert.equal(job.status, JobStatus.DONE); - assert.equal(job.query, QUERY); + assert.strictEqual(job.status, JobStatus.DONE); + assert.strictEqual(job.query, QUERY); return done(); }); @@ -97,8 +97,8 @@ describe('Handle query middleware', function () { jobResult.getStatus(function (err, job) { assert.ok(!err); - assert.equal(job.status, JobStatus.DONE); - assert.deepEqual(job.query, [ + assert.strictEqual(job.status, JobStatus.DONE); + assert.deepStrictEqual(job.query, [ { query: QUERY, status: JobStatus.DONE }, { query: QUERY, status: JobStatus.DONE } ]); diff --git a/test/acceptance/health-check-test.js b/test/acceptance/health-check-test.js index f09b1315..dcee10df 100644 --- a/test/acceptance/health-check-test.js +++ b/test/acceptance/health-check-test.js @@ -37,7 +37,7 @@ describe('health checks', function () { var parsed = JSON.parse(res.body); - assert.equal(parsed.enabled, false); + assert.strictEqual(parsed.enabled, false); assert.ok(parsed.ok); done(); diff --git a/test/acceptance/last-modified-header-test.js b/test/acceptance/last-modified-header-test.js index 8c82fa34..0b8afd5d 100644 --- a/test/acceptance/last-modified-header-test.js +++ b/test/acceptance/last-modified-header-test.js @@ -51,7 +51,7 @@ describe('last modified header', function () { statusCode: 200 }, function (err, res) { - assert.equal(res.headers['last-modified'], scenario.expectedLastModified); + assert.strictEqual(res.headers['last-modified'], scenario.expectedLastModified); done(); } ); @@ -78,7 +78,7 @@ describe('last modified header', function () { }, function (err, res) { MockDate.reset(); - assert.equal(res.headers['last-modified'], new Date(fixedDateNow).toUTCString()); + assert.strictEqual(res.headers['last-modified'], new Date(fixedDateNow).toUTCString()); done(); } ); @@ -104,7 +104,7 @@ describe('last modified header', function () { }, function (err, res) { MockDate.reset(); - assert.equal(res.headers['last-modified'], new Date(fixedDateNow).toUTCString()); + assert.strictEqual(res.headers['last-modified'], new Date(fixedDateNow).toUTCString()); done(); } ); diff --git a/test/acceptance/log-test.js b/test/acceptance/log-test.js index dbcf375f..1ac12cf7 100644 --- a/test/acceptance/log-test.js +++ b/test/acceptance/log-test.js @@ -42,7 +42,7 @@ describe('Log middleware', function () { assert.ok(res.headers['x-sqlapi-log']); const log = JSON.parse(res.headers['x-sqlapi-log']); - assert.deepEqual(log, { + assert.deepStrictEqual(log, { request: { sql: { type: TYPES.QUERY, @@ -104,7 +104,7 @@ describe('Log middleware', function () { assert.ok(res.headers['x-sqlapi-log']); const log = JSON.parse(res.headers['x-sqlapi-log']); - assert.deepEqual(log, { + assert.deepStrictEqual(log, { request: { sql: { type: TYPES.JOB, @@ -142,11 +142,14 @@ describe('Log middleware', function () { assert.ok(res.headers['x-sqlapi-log']); const log = JSON.parse(res.headers['x-sqlapi-log']); - assert.deepEqual(log, { + assert.deepStrictEqual(log, { request: { sql: { 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']); const log = JSON.parse(res.headers['x-sqlapi-log']); - assert.deepEqual(log, { + assert.deepStrictEqual(log, { request: { sql: { 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']); const log = JSON.parse(res.headers['x-sqlapi-log']); - assert.deepEqual(log, { + assert.deepStrictEqual(log, { request: { sql: null } diff --git a/test/acceptance/pagination-test.js b/test/acceptance/pagination-test.js index 76dcd981..f1077791 100644 --- a/test/acceptance/pagination-test.js +++ b/test/acceptance/pagination-test.js @@ -25,9 +25,9 @@ describe('results-pagination', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, 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); - assert.equal(parsed.rows.length, 1); + assert.strictEqual(parsed.rows.length, 1); done(); }); }); @@ -83,11 +83,11 @@ describe('results-pagination', function () { } assert.response(server, req, RESPONSE_OK, function (err, res) { 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) { var obt = parsed.rows[i].v; 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(); }); @@ -111,11 +111,11 @@ describe('results-pagination', function () { method: 'GET' }, RESPONSE_OK, function (err, res) { 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) { var obt = parsed.rows[i].v; 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(); }); @@ -155,7 +155,7 @@ describe('results-pagination', function () { function check_res_drop_table (err, res) { assert.ifError(err); 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; assert.response(server, { url: '/api/v1/sql?' + querystring.stringify({ diff --git a/test/acceptance/pg-entities-access-validator-test.js b/test/acceptance/pg-entities-access-validator-test.js index 77b0abd0..e9e74e82 100644 --- a/test/acceptance/pg-entities-access-validator-test.js +++ b/test/acceptance/pg-entities-access-validator-test.js @@ -21,7 +21,7 @@ describe('PG entities access validator', function () { function assertQuery (query, testClient, done) { testClient.getResult(query, expectedResponse, (err, result) => { assert.ifError(err); - assert.equal(result.error, 'system tables are forbidden'); + assert.deepStrictEqual(result.error, ['system tables are forbidden']); done(); }); } diff --git a/test/acceptance/pg-types-test.js b/test/acceptance/pg-types-test.js index 4f4db63b..14a549f2 100644 --- a/test/acceptance/pg-types-test.js +++ b/test/acceptance/pg-types-test.js @@ -23,7 +23,7 @@ describe('PG field type information', function () { function (err, res) { const body = JSON.parse(res.body); - assert.deepEqual(body.fields, { + assert.deepStrictEqual(body.fields, { geography_point_4326: { type: 'geography', wkbtype: 'Point', dims: 2, srid: 4326 }, diff --git a/test/acceptance/query-float-values-test.js b/test/acceptance/query-float-values-test.js index 55892477..6997fc03 100644 --- a/test/acceptance/query-float-values-test.js +++ b/test/acceptance/query-float-values-test.js @@ -61,10 +61,10 @@ describe('special numeric (float) values', function () { assert.ifError(err); var result = JSON.parse(res.body); assert.ok(Array.isArray(result.rows)); - assert.equal(result.rows[0].val, 'NaN'); - assert.equal(result.rows[1].val, 'Infinity'); - assert.equal(result.rows[2].val, '-Infinity'); - assert.equal(result.rows[3].val, 1); + assert.strictEqual(result.rows[0].val, 'NaN'); + assert.strictEqual(result.rows[1].val, 'Infinity'); + assert.strictEqual(result.rows[2].val, '-Infinity'); + assert.strictEqual(result.rows[3].val, 1); done(); } ); diff --git a/test/acceptance/query-multipart-test.js b/test/acceptance/query-multipart-test.js index 733d49e8..4ce3607b 100644 --- a/test/acceptance/query-multipart-test.js +++ b/test/acceptance/query-multipart-test.js @@ -17,7 +17,7 @@ describe('query-multipart', function () { }, {}, function (err, res) { assert.ifError(err); 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.deepStrictEqual(response.rows, [{ n: 2 }]); done(); diff --git a/test/acceptance/query-returning-test.js b/test/acceptance/query-returning-test.js index 56f31b85..d3b2c5b2 100644 --- a/test/acceptance/query-returning-test.js +++ b/test/acceptance/query-returning-test.js @@ -29,12 +29,12 @@ describe('query-returning', function () { }, RESPONSE_OK, function (err, res) { var out = JSON.parse(res.body); assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 2); - assert.equal(out.rows.length, 0); + assert.strictEqual(out.total_rows, 2); + assert.strictEqual(out.rows.length, 0); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -54,12 +54,12 @@ describe('query-returning', function () { }, RESPONSE_OK, function (err, res) { var out = JSON.parse(res.body); assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 2); - assert.equal(out.rows.length, 0); + assert.strictEqual(out.total_rows, 2); + assert.strictEqual(out.rows.length, 0); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -79,12 +79,12 @@ describe('query-returning', function () { }, RESPONSE_OK, function (err, res) { var out = JSON.parse(res.body); assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 2); - assert.equal(out.rows.length, 0); + assert.strictEqual(out.total_rows, 2); + assert.strictEqual(out.rows.length, 0); // Check cache headers // See https://github.com/Vizzuality/CartoDB-SQL-API/issues/43 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(); }); }); @@ -104,11 +104,11 @@ describe('query-returning', function () { }, RESPONSE_OK, function (err, res) { var out = JSON.parse(res.body); assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 1); - assert.equal(out.rows.length, 1); - assert.equal(_.keys(out.rows[0]).length, 2); - assert.equal(out.rows[0].upper, 'TEST'); - assert.equal(out.rows[0].reverse, 'tset'); + assert.strictEqual(out.total_rows, 1); + assert.strictEqual(out.rows.length, 1); + assert.strictEqual(_.keys(out.rows[0]).length, 2); + assert.strictEqual(out.rows[0].upper, 'TEST'); + assert.strictEqual(out.rows[0].reverse, 'tset'); done(); }); }); @@ -128,11 +128,11 @@ describe('query-returning', function () { }, RESPONSE_OK, function (err, res) { var out = JSON.parse(res.body); assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 1); - assert.equal(out.rows.length, 1); - assert.equal(_.keys(out.rows[0]).length, 2); - assert.equal(out.rows[0].upper, 'TOST'); - assert.equal(out.rows[0].reverse, 'tsot'); + assert.strictEqual(out.total_rows, 1); + assert.strictEqual(out.rows.length, 1); + assert.strictEqual(_.keys(out.rows[0]).length, 2); + assert.strictEqual(out.rows[0].upper, 'TOST'); + assert.strictEqual(out.rows[0].reverse, 'tsot'); done(); }); }); @@ -152,10 +152,10 @@ describe('query-returning', function () { }, RESPONSE_OK, function (err, res) { var out = JSON.parse(res.body); assert.ok(out.hasOwnProperty('time')); - assert.equal(out.total_rows, 1); - assert.equal(out.rows.length, 1); - assert.equal(_.keys(out.rows[0]).length, 1); - assert.equal(out.rows[0].name, 'tost'); + assert.strictEqual(out.total_rows, 1); + assert.strictEqual(out.rows.length, 1); + assert.strictEqual(_.keys(out.rows[0]).length, 1); + assert.strictEqual(out.rows[0].name, 'tost'); done(); }); }); diff --git a/test/acceptance/rate-limit-test.js b/test/acceptance/rate-limit-test.js index ad5ed047..e154caed 100644 --- a/test/acceptance/rate-limit-test.js +++ b/test/acceptance/rate-limit-test.js @@ -46,12 +46,12 @@ function assertRequest (status, limit, remaining, reset, retry, done = null) { { status }, function (err, res) { assert.ifError(err); - assert.equal(res.headers['carto-rate-limit-limit'], limit); - assert.equal(res.headers['carto-rate-limit-remaining'], remaining); - assert.equal(res.headers['carto-rate-limit-reset'], reset); + assert.strictEqual(res.headers['carto-rate-limit-limit'], limit); + assert.strictEqual(res.headers['carto-rate-limit-remaining'], remaining); + assert.strictEqual(res.headers['carto-rate-limit-reset'], reset); if (retry) { - assert.equal(res.headers['retry-after'], retry); + assert.strictEqual(res.headers['retry-after'], retry); } if (status === 429) { @@ -61,7 +61,7 @@ function assertRequest (status, limit, remaining, reset, retry, done = null) { detail: 'rate-limit' }; - assert.deepEqual(JSON.parse(res.body), expectedResponse); + assert.deepStrictEqual(JSON.parse(res.body), expectedResponse); } if (done) { @@ -95,11 +95,11 @@ describe('rate limit', function () { }); it('1 req/sec: 2 req/seg should be limited', function (done) { - assertRequest(200, 2, 1, 1); - setTimeout(() => assertRequest(200, 2, 0, 1, null), 250); - setTimeout(() => assertRequest(429, 2, 0, 1, 1), 500); - setTimeout(() => assertRequest(429, 2, 0, 1, 1), 750); - setTimeout(() => assertRequest(429, 2, 0, 1, 1), 950); - setTimeout(() => assertRequest(200, 2, 0, 1, null, done), 1050); + assertRequest(200, '2', '1', '1'); + setTimeout(() => assertRequest(200, '2', '0', '1', null), 250); + setTimeout(() => assertRequest(429, '2', '0', '1', '1'), 500); + setTimeout(() => assertRequest(429, '2', '0', '1', '1'), 750); + setTimeout(() => assertRequest(429, '2', '0', '1', '1'), 950); + setTimeout(() => assertRequest(200, '2', '0', '1', null, done), 1050); }); }); diff --git a/test/acceptance/regressions-test.js b/test/acceptance/regressions-test.js index ba64a268..fd1b963f 100644 --- a/test/acceptance/regressions-test.js +++ b/test/acceptance/regressions-test.js @@ -37,7 +37,7 @@ describe('regressions', function () { return done(err); } 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, function (err, res) { @@ -48,8 +48,8 @@ describe('regressions', function () { // table should not get a cache channel as it won't get invalidated assert.ok(!res.headers.hasOwnProperty('x-cache-channel')); var parsedBody = JSON.parse(res.body); - assert.equal(parsedBody.total_rows, 2); - assert.deepEqual(parsedBody.rows, [{ a: 1 }, { a: 2 }]); + assert.strictEqual(parsedBody.total_rows, 2); + assert.deepStrictEqual(parsedBody.rows, [{ a: 1 }, { a: 2 }]); // delete table assert.response(server, createRequest('DROP TABLE "foo.bar"'), responseOk, done); diff --git a/test/acceptance/skipfields-test.js b/test/acceptance/skipfields-test.js index 4ce223d2..14b113a3 100644 --- a/test/acceptance/skipfields-test.js +++ b/test/acceptance/skipfields-test.js @@ -63,7 +63,7 @@ describe('skipfields', function () { method: 'GET' }, RESPONSE_OK, function (err, res) { 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('b')); assert.ok(parsedBody.fields.hasOwnProperty('c')); @@ -76,7 +76,7 @@ describe('skipfields', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, 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 checkfields = { name: 1, cartodb_id: 1, the_geom: 1, the_geom_webmercator: 1 }; for (var f in checkfields) { diff --git a/test/acceptance/stream-responses-test.js b/test/acceptance/stream-responses-test.js index b71f88df..902c3737 100644 --- a/test/acceptance/stream-responses-test.js +++ b/test/acceptance/stream-responses-test.js @@ -37,8 +37,8 @@ describe('stream-responses', function () { okResponse, function (err, res) { var parsedBody = JSON.parse(res.body); - assert.equal(parsedBody.rows.length, 2); - assert.deepEqual(parsedBody.error, ['division by zero']); + assert.strictEqual(parsedBody.rows.length, 2); + assert.deepStrictEqual(parsedBody.error, ['division by zero']); done(); } ); @@ -53,8 +53,8 @@ describe('stream-responses', function () { okResponse, function (err, res) { var parsedBody = JSON.parse(res.body); - assert.equal(parsedBody.features.length, 2); - assert.deepEqual(parsedBody.error, ['division by zero']); + assert.strictEqual(parsedBody.features.length, 2); + assert.deepStrictEqual(parsedBody.error, ['division by zero']); done(); } ); diff --git a/test/acceptance/surrogate-key-test.js b/test/acceptance/surrogate-key-test.js index 0647da8d..8a87a8d2 100644 --- a/test/acceptance/surrogate-key-test.js +++ b/test/acceptance/surrogate-key-test.js @@ -32,10 +32,10 @@ describe('Surrogate-Key header', function () { var expectedSurrogateKeys = new QueryTables.QueryMetadata(expectedTables).key(); - assert.equal(surrogateKeys.length, expectedSurrogateKeys.length); + assert.strictEqual(surrogateKeys.length, expectedSurrogateKeys.length); 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) { diff --git a/test/acceptance/system-queries-test.js b/test/acceptance/system-queries-test.js index d898020f..1460aecb 100644 --- a/test/acceptance/system-queries-test.js +++ b/test/acceptance/system-queries-test.js @@ -52,7 +52,7 @@ describe('system-queries', function () { url: '/api/v1/sql?' + querystring.stringify(queryStringParams) }; assert.response(server, request, function (err, response) { - assert.equal(response.statusCode, statusErrorCode); + assert.strictEqual(response.statusCode, statusErrorCode); done(); }); }); diff --git a/test/acceptance/transaction-test.js b/test/acceptance/transaction-test.js index a503a59b..8906d33c 100644 --- a/test/acceptance/transaction-test.js +++ b/test/acceptance/transaction-test.js @@ -33,19 +33,19 @@ describe('transaction', function () { it('should NOT fail to second request after error in transaction', function (done) { sqlRequest(requestUrl(errorQuery), function (err, response, body) { assert.ok(!err); - assert.equal(response.statusCode, 400); + assert.strictEqual(response.statusCode, 400); var parsedBody = JSON.parse(body); 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) { assert.ok(!err); - assert.equal(response.statusCode, 200); + assert.strictEqual(response.statusCode, 200); var parsedBody = JSON.parse(body); assert.ok(parsedBody); - assert.deepEqual(parsedBody.rows, [{ foo: 1 }]); + assert.deepStrictEqual(parsedBody.rows, [{ foo: 1 }]); done(); }); diff --git a/test/acceptance/x-cache-channel-test.js b/test/acceptance/x-cache-channel-test.js index b1f99f98..6efa3432 100644 --- a/test/acceptance/x-cache-channel-test.js +++ b/test/acceptance/x-cache-channel-test.js @@ -30,13 +30,13 @@ describe('X-Cache-Channel header', function () { var databaseAndTables = xCacheChannel.split(':'); 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(','); - assert.equal(headerTableNames.length, expectedTablesNames.length); + assert.strictEqual(headerTableNames.length, expectedTablesNames.length); 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) { diff --git a/test/integration/batch/job-backend-test.js b/test/integration/batch/job-backend-test.js index 087f587c..8455b5f1 100644 --- a/test/integration/batch/job-backend-test.js +++ b/test/integration/batch/job-backend-test.js @@ -50,7 +50,7 @@ describe('job backend', function () { } assert.ok(jobCreated.job_id); - assert.equal(jobCreated.status, jobStatus.PENDING); + assert.strictEqual(jobCreated.status, jobStatus.PENDING); done(); }); }); @@ -62,8 +62,8 @@ describe('job backend', function () { jobBackend.create(job.data, function (err) { assert.ok(err); - assert.equal(err.name, 'NotFoundError'); - assert.equal(err.message, 'Job with id undefined not found'); + assert.strictEqual(err.name, 'NotFoundError'); + assert.strictEqual(err.message, 'Job with id undefined not found'); done(); }); }); @@ -83,11 +83,11 @@ describe('job backend', function () { return done(err); } - assert.equal(job.job_id, jobCreated.job_id); - assert.equal(job.user, jobData.data.user); - assert.equal(job.query, jobData.data.query); - assert.equal(job.host, jobData.data.host); - assert.equal(job.status, jobStatus.PENDING); + assert.strictEqual(job.job_id, jobCreated.job_id); + assert.strictEqual(job.user, jobData.data.user); + assert.strictEqual(job.query, jobData.data.query); + assert.strictEqual(job.host, jobData.data.host); + assert.strictEqual(job.status, jobStatus.PENDING); done(); }); }); @@ -110,7 +110,7 @@ describe('job backend', function () { return done(err); } - assert.equal(jobUpdated.query, 'select pg_sleep(1)'); + assert.strictEqual(jobUpdated.query, 'select pg_sleep(1)'); done(); }); }); @@ -121,8 +121,8 @@ describe('job backend', function () { jobBackend.update(job.data, function (err) { assert.ok(err, err); - assert.equal(err.name, 'NotFoundError'); - assert.equal(err.message, 'Job with id ' + job.data.job_id + ' not found'); + assert.strictEqual(err.name, 'NotFoundError'); + assert.strictEqual(err.message, 'Job with id ' + job.data.job_id + ' not found'); done(); }); }); @@ -137,10 +137,10 @@ describe('job backend', function () { assert.ok(jobSaved.job_id); - assert.equal(jobSaved.user, job.data.user); - assert.equal(jobSaved.query, job.data.query); - assert.equal(jobSaved.host, job.data.host); - assert.equal(jobSaved.status, jobStatus.PENDING); + assert.strictEqual(jobSaved.user, job.data.user); + assert.strictEqual(jobSaved.query, job.data.query); + assert.strictEqual(jobSaved.host, job.data.host); + assert.strictEqual(jobSaved.status, jobStatus.PENDING); done(); }); }); @@ -167,7 +167,7 @@ describe('job backend', function () { if (err) { return done(err); } - assert.deepEqual(results[2], ['wadus']); + assert.deepStrictEqual(results[2], ['wadus']); done(); }); }); @@ -192,9 +192,9 @@ describe('job backend', function () { } assert.ok(users.userA); - assert.deepEqual(users.userA, ['jobId1', 'jobId2']); + assert.deepStrictEqual(users.userA, ['jobId1', 'jobId2']); assert.ok(users.userB); - assert.deepEqual(users.userB, ['jobId3']); + assert.deepStrictEqual(users.userB, ['jobId3']); done(); }); }); diff --git a/test/integration/batch/job-canceller-test.js b/test/integration/batch/job-canceller-test.js index 34211c00..67ad7afa 100644 --- a/test/integration/batch/job-canceller-test.js +++ b/test/integration/batch/job-canceller-test.js @@ -89,7 +89,7 @@ describe('job canceller', function () { 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) { if (err) { diff --git a/test/integration/batch/job-publisher-test.js b/test/integration/batch/job-publisher-test.js index 82e43d88..e0c59921 100644 --- a/test/integration/batch/job-publisher-test.js +++ b/test/integration/batch/job-publisher-test.js @@ -25,8 +25,8 @@ describe('job publisher', function () { client.subscribe(Channel.NAME); client.on('message', function (channel, host) { - assert.equal(host, HOST); - assert.equal(channel, Channel.NAME); + assert.strictEqual(host, HOST); + assert.strictEqual(channel, Channel.NAME); client.unsubscribe(Channel.NAME); done(); }); diff --git a/test/integration/batch/job-queue-test.js b/test/integration/batch/job-queue-test.js index 1eb343aa..c070e986 100644 --- a/test/integration/batch/job-queue-test.js +++ b/test/integration/batch/job-queue-test.js @@ -44,8 +44,8 @@ describe('job queue', function () { self.jobQueue.scanQueues(function (err, queues) { assert.ifError(err); - assert.equal(queues.length, 1); - assert.equal(queues[0], userA); + assert.strictEqual(queues.length, 1); + assert.strictEqual(queues[0], userA); return done(); }); }); @@ -65,7 +65,7 @@ describe('job queue', function () { self.jobQueue.scanQueues(function (err, queues) { assert.ifError(err); - assert.equal(queues.length, 2); + assert.strictEqual(queues.length, 2); assert.ok(queues[0] === userA || queues[0] === userB); assert.ok(queues[1] === userA || queues[1] === userB); @@ -79,12 +79,12 @@ describe('job queue', function () { var self = this; var redisArgs = [JobQueue.QUEUE.PREFIX + userA, 'wadus-id']; metadataBackend.redisCmd(JobQueue.QUEUE.DB, 'LPUSH', redisArgs, function (err) { - assert.ok(!err, err); + assert.ifError(err); self.jobQueue.scanQueues(function (err, queues) { - assert.ok(!err, err); + assert.ifError(err); - assert.equal(queues.length, 1); - assert.equal(queues[0], userA); + assert.strictEqual(queues.length, 1); + assert.strictEqual(queues[0], userA); return done(); }); @@ -110,7 +110,7 @@ describe('job queue', function () { return done(err); } - assert.equal(queuesFromScan.length, 1); + assert.strictEqual(queuesFromScan.length, 1); assert.ok(queuesFromScan.indexOf(data.user) >= 0); self.jobQueue.getQueues(function (err, queuesFromIndex) { @@ -118,7 +118,7 @@ describe('job queue', function () { done(err); } - assert.equal(queuesFromIndex.length, 1); + assert.strictEqual(queuesFromIndex.length, 1); assert.ok(queuesFromIndex.indexOf(data.user) >= 0); redisUtils.clean('batch:*', done); @@ -157,7 +157,7 @@ describe('job queue', function () { return done(err); } - assert.equal(queuesFromScan.length, 2); + assert.strictEqual(queuesFromScan.length, 2); assert.ok(queuesFromScan.indexOf(jobVizzuality.user) >= 0); assert.ok(queuesFromScan.indexOf(jobWadus.user) >= 0); @@ -166,7 +166,7 @@ describe('job queue', function () { done(err); } - assert.equal(queuesFromIndex.length, 2); + assert.strictEqual(queuesFromIndex.length, 2); assert.ok(queuesFromIndex.indexOf(jobVizzuality.user) >= 0); assert.ok(queuesFromIndex.indexOf(jobWadus.user) >= 0); diff --git a/test/integration/batch/job-runner-test.js b/test/integration/batch/job-runner-test.js index a1420517..e712bf00 100644 --- a/test/integration/batch/job-runner-test.js +++ b/test/integration/batch/job-runner-test.js @@ -63,7 +63,7 @@ describe('job runner', function () { return done(err); } - assert.equal(job.data.status, jobStatus.DONE); + assert.strictEqual(job.data.status, jobStatus.DONE); done(); }); }); @@ -72,8 +72,8 @@ describe('job runner', function () { it('.run() should return a job not found error', function (done) { jobRunner.run('wadus_job_id', function (err) { assert.ok(err, err); - assert.equal(err.name, 'NotFoundError'); - assert.equal(err.message, 'Job with id wadus_job_id not found'); + assert.strictEqual(err.name, 'NotFoundError'); + assert.strictEqual(err.message, 'Job with id wadus_job_id not found'); done(); }); }); diff --git a/test/integration/batch/job-service-test.js b/test/integration/batch/job-service-test.js index 34035a80..e9b2a3fc 100644 --- a/test/integration/batch/job-service-test.js +++ b/test/integration/batch/job-service-test.js @@ -94,7 +94,7 @@ describe('job service', function () { return done(err); } - assert.equal(job.data.job_id, jobCreated.data.job_id); + assert.strictEqual(job.data.job_id, jobCreated.data.job_id); done(); }); }); @@ -103,7 +103,7 @@ describe('job service', function () { it('.get() should return a not found error', function (done) { jobService.get('wadus_job_id', function (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(); }); }); @@ -115,7 +115,7 @@ describe('job service', function () { } assert.ok(jobCreated.data.job_id); - assert.equal(jobCreated.data.status, jobStatus.PENDING); + assert.strictEqual(jobCreated.data.status, jobStatus.PENDING); done(); }); }); @@ -127,7 +127,7 @@ describe('job service', function () { jobService.create(job, function (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(); }); }); @@ -151,8 +151,8 @@ describe('job service', function () { return done(err); } - assert.equal(jobCancelled.data.job_id, job.data.job_id); - assert.equal(jobCancelled.data.status, jobStatus.CANCELLED); + assert.strictEqual(jobCancelled.data.job_id, job.data.job_id); + assert.strictEqual(jobCancelled.data.status, jobStatus.CANCELLED); done(); }); }); @@ -162,8 +162,8 @@ describe('job service', function () { it('.cancel() should return a job not found error', function (done) { jobService.cancel('wadus_job_id', function (err) { assert.ok(err, err); - assert.equal(err.name, 'NotFoundError'); - assert.equal(err.message, 'Job with id wadus_job_id not found'); + assert.strictEqual(err.name, 'NotFoundError'); + assert.strictEqual(err.message, 'Job with id wadus_job_id not found'); done(); }); }); @@ -187,8 +187,8 @@ describe('job service', function () { return done(err); } - assert.equal(jobDrained.job_id, job.data.job_id); - assert.equal(jobDrained.status, jobStatus.PENDING); + assert.strictEqual(jobDrained.job_id, job.data.job_id); + assert.strictEqual(jobDrained.status, jobStatus.PENDING); done(); }); }); @@ -198,8 +198,8 @@ describe('job service', function () { it('.drain() should return a job not found error', function (done) { jobService.drain('wadus_job_id', function (err) { assert.ok(err, err); - assert.equal(err.name, 'NotFoundError'); - assert.equal(err.message, 'Job with id wadus_job_id not found'); + assert.strictEqual(err.name, 'NotFoundError'); + assert.strictEqual(err.message, 'Job with id wadus_job_id not found'); done(); }); }); diff --git a/test/integration/batch/locker-test.js b/test/integration/batch/locker-test.js index e17bae04..7e74a064 100644 --- a/test/integration/batch/locker-test.js +++ b/test/integration/batch/locker-test.js @@ -25,7 +25,7 @@ describe('locker', function () { // others can't lock on same host lockerB.lock(host, function (err) { assert.ok(err); - assert.equal(err.name, 'LockError'); + assert.strictEqual(err.name, 'LockError'); lockerA.unlock(host, function (err) { assert.ok(!err); diff --git a/test/integration/batch/scheduler-test.js b/test/integration/batch/scheduler-test.js index f6b3689a..8867e9e1 100644 --- a/test/integration/batch/scheduler-test.js +++ b/test/integration/batch/scheduler-test.js @@ -62,12 +62,12 @@ describe('scheduler', function () { scheduler.on('done', function () { var results = taskRunner.results; - assert.equal(results.length, 4); + assert.strictEqual(results.length, 4); - assert.equal(results[0], USER_A); - assert.equal(results[1], USER_B); - assert.equal(results[2], USER_A); - assert.equal(results[3], USER_B); + assert.strictEqual(results[0], USER_A); + assert.strictEqual(results[1], USER_B); + assert.strictEqual(results[2], USER_A); + assert.strictEqual(results[3], USER_B); return done(); }); @@ -86,12 +86,12 @@ describe('scheduler', function () { scheduler.on('done', function () { debug('Users %j', acquiredUsers); - assert.equal(acquiredUsers[0], USER_A); - assert.equal(acquiredUsers[1], USER_B); - assert.equal(acquiredUsers[2], USER_A); - assert.equal(acquiredUsers[3], USER_B); + assert.strictEqual(acquiredUsers[0], USER_A); + assert.strictEqual(acquiredUsers[1], USER_B); + assert.strictEqual(acquiredUsers[2], USER_A); + assert.strictEqual(acquiredUsers[3], USER_B); - assert.equal(acquiredUsers.length, 4); + assert.strictEqual(acquiredUsers.length, 4); return done(); }); @@ -128,9 +128,9 @@ describe('scheduler', function () { scheduler.on('done', function () { 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(); }); @@ -152,11 +152,11 @@ describe('scheduler', function () { scheduler.on('done', function () { var results = taskRunner.results; - assert.equal(results.length, 3); + assert.strictEqual(results.length, 3); - assert.equal(results[0], USER_A); - assert.equal(results[1], USER_B); - assert.equal(results[2], USER_C); + assert.strictEqual(results[0], USER_A); + assert.strictEqual(results[1], USER_B); + assert.strictEqual(results[2], USER_C); return done(); }); @@ -182,14 +182,14 @@ describe('scheduler', function () { scheduler.on('done', function () { var results = taskRunner.results; - assert.equal(results.length, 6); + assert.strictEqual(results.length, 6); - assert.equal(results[0], USER_A); - assert.equal(results[1], USER_B); - assert.equal(results[2], USER_C); - assert.equal(results[3], USER_A); - assert.equal(results[4], USER_B); - assert.equal(results[5], USER_A); + assert.strictEqual(results[0], USER_A); + assert.strictEqual(results[1], USER_B); + assert.strictEqual(results[2], USER_C); + assert.strictEqual(results[3], USER_A); + assert.strictEqual(results[4], USER_B); + assert.strictEqual(results[5], USER_A); return done(); }); diff --git a/test/integration/stream-copy-test.js b/test/integration/stream-copy-test.js index 7a9f82f8..e976e961 100644 --- a/test/integration/stream-copy-test.js +++ b/test/integration/stream-copy-test.js @@ -15,7 +15,7 @@ describe('stream copy', function () { }; const sql = 'COPY dummy_table FROM STDIN'; 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(); }); }); diff --git a/test/support/assert.js b/test/support/assert.js index f2b5ea75..d700ca8e 100644 --- a/test/support/assert.js +++ b/test/support/assert.js @@ -80,7 +80,7 @@ assert.response = function (server, req, res, callback) { // Assert response status if (typeof status === 'number') { - assert.equal(response.statusCode, status, + assert.strictEqual(response.statusCode, status, colorize('[red]{Invalid response status code.}\n' + ' Expected: [green]{' + status + '}\n' + ' Got: [red]{' + response.statusCode + '}\n' + diff --git a/test/support/batch-test-client.js b/test/support/batch-test-client.js index a28930c9..40e24549 100644 --- a/test/support/batch-test-client.js +++ b/test/support/batch-test-client.js @@ -277,7 +277,7 @@ JobResult.prototype.validateExpectedResponse = function (expected) { var expectedQuery = expected.query[index]; assert.ok(expectedQuery); Object.keys(expectedQuery).forEach(function (expectedKey) { - assert.equal( + assert.strictEqual( actualQuery[expectedKey], expectedQuery[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.equal(actual.onerror, expected.onerror); + assert.strictEqual(actual.onsuccess, expected.onsuccess); + assert.strictEqual(actual.onerror, expected.onerror); }; diff --git a/test/unit/apikeyauth-test.js b/test/unit/apikeyauth-test.js index d4ae985b..f5fff141 100644 --- a/test/unit/apikeyauth-test.js +++ b/test/unit/apikeyauth-test.js @@ -66,7 +66,7 @@ describe.skip('has credentials', function () { function testCredentials (req, hasCredentials) { 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) { var apiKeyAuth = new ApikeyAuth(req); apiKeyAuth.verifyCredentials(options, function (err, validCredentials) { - assert.equal(validCredentials, shouldBeValid); + assert.strictEqual(validCredentials, shouldBeValid); done(); }); } diff --git a/test/unit/error-handler-factory-test.js b/test/unit/error-handler-factory-test.js index 82e4f3d1..a7b61e68 100644 --- a/test/unit/error-handler-factory-test.js +++ b/test/unit/error-handler-factory-test.js @@ -36,7 +36,7 @@ describe('error-handler-factory', function () { 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 }); - assert.deepEqual(errorHandler, expectedError); + assert.deepStrictEqual(errorHandler, expectedError); }); it('permission denied error', function () { @@ -66,6 +66,6 @@ describe('error-handler-factory', function () { name: codeToCondition[error.code] || error.name }); - assert.deepEqual(errorHandler, expectedError); + assert.deepStrictEqual(errorHandler, expectedError); }); }); diff --git a/test/unit/error-handler-test.js b/test/unit/error-handler-test.js index 13e9e115..ca127d4d 100644 --- a/test/unit/error-handler-test.js +++ b/test/unit/error-handler-test.js @@ -52,7 +52,7 @@ describe('error-handler', function () { errorMiddleware()(error, req, res, function next () { assert.ok(res.headers['X-SQLAPI-Errors'].length > 0); - assert.deepEqual( + assert.deepStrictEqual( res.headers['X-SQLAPI-Errors'], JSON.stringify(errorHeader) ); @@ -78,7 +78,7 @@ describe('error-handler', function () { errorMiddleware()(error, req, res, function next () { assert.ok(res.headers['X-SQLAPI-Errors'].length > 0); - assert.deepEqual( + assert.deepStrictEqual( res.headers['X-SQLAPI-Errors'], JSON.stringify(errorHeader) ); @@ -107,7 +107,7 @@ describe('error-handler', function () { errorMiddleware()(error, req, res, function () { assert.ok(res.headers['X-SQLAPI-Errors'].length > 0); - assert.deepEqual( + assert.deepStrictEqual( res.headers['X-SQLAPI-Errors'], JSON.stringify(errorHeader) ); @@ -131,7 +131,7 @@ describe('error-handler', function () { errorMiddleware()(error, req, res, function () { assert.ok(res.headers['X-SQLAPI-Errors'].length > 0); - assert.deepEqual( + assert.deepStrictEqual( res.headers['X-SQLAPI-Errors'], JSON.stringify(expectedErrorHeader) ); diff --git a/test/unit/health-check-test.js b/test/unit/health-check-test.js index ea2bbd51..3385a714 100644 --- a/test/unit/health-check-test.js +++ b/test/unit/health-check-test.js @@ -22,8 +22,8 @@ describe('health checks', function () { callback(null, 'Maintenance'); }; healthCheck.check(function (err) { - assert.equal(err.message, 'Maintenance'); - assert.equal(err.http_status, 503); + assert.strictEqual(err.message, 'Maintenance'); + assert.strictEqual(err.http_status, 503); fs.readFile = readFileFn; done(); }); @@ -37,7 +37,7 @@ describe('health checks', function () { callback(new Error('ENOENT'), null); }; healthCheck.check(function (err) { - assert.equal(err, null); + assert.strictEqual(err, undefined); fs.readFile = readFileFn; done(); }); diff --git a/test/unit/model/bin-encoder-test.js b/test/unit/model/bin-encoder-test.js index 73adfa9d..93037fc5 100644 --- a/test/unit/model/bin-encoder-test.js +++ b/test/unit/model/bin-encoder-test.js @@ -8,31 +8,31 @@ var ArrayBufferSer = require('../../../lib/models/bin-encoder'); describe('ArrayBufferSer', function () { it('calculate size for basic types', function () { 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]); - assert.equal(4, b.getDataSize()); + assert.strictEqual(4, b.getDataSize()); 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 () { 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 bc = new ArrayBufferSer(ArrayBufferSer.INT16, [1, 4]); b = new ArrayBufferSer(ArrayBufferSer.BUFFER, [ba, bc]); - assert.equal((b.headerSize + 4 + 2) * 2, b.getDataSize()); - assert.equal(b.type, ArrayBufferSer.BUFFER); + assert.strictEqual((b.headerSize + 4 + 2) * 2, b.getDataSize()); + assert.strictEqual(b.type, ArrayBufferSer.BUFFER); }); 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) { - 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]); } } diff --git a/test/unit/oauth-test.js b/test/unit/oauth-test.js index fcb6d17e..50960b8e 100644 --- a/test/unit/oauth-test.js +++ b/test/unit/oauth-test.js @@ -45,11 +45,11 @@ var metadataBackend = new MetadataDB({ describe('oauth', function () { it('test database number', function () { - assert.equal(oAuth.oauth_database, 3); + assert.strictEqual(oAuth.oauth_database, 3); }); 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 () { @@ -65,7 +65,7 @@ describe('oauth', function () { it('test headers take presedence over query parameters', function () { var req = { query: { oauth_signature_method: 'MY_HASH' }, headers: { authorization: full_oauth_header } }; 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) { @@ -73,7 +73,8 @@ describe('oauth', function () { var tokens = oAuth.parseTokens(req); 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(); }); }); @@ -83,8 +84,8 @@ describe('oauth', function () { var tokens = oAuth.parseTokens(req); oAuth.getOAuthHash(metadataBackend, tokens.oauth_token, function (err, data) { - assert.ok(!err, err); - assert.deepEqual(data, {}); + assert.ifError(err); + assert.deepStrictEqual(data, {}); done(); }); }); @@ -100,8 +101,8 @@ describe('oauth', function () { }; oAuth.verifyRequest(req, metadataBackend, function (err, data) { - assert.ok(!err, err); - assert.equal(data, 'master'); + assert.ifError(err); + assert.strictEqual(data, 'master'); done(); }); }); @@ -122,8 +123,8 @@ describe('oauth', function () { oAuth.verifyRequest(req, metadataBackend, function (err, data) { oAuth.getAllowedHosts = oAuthGetAllowedHostsFn; - assert.ok(!err, err); - assert.equal(data, 'master'); + assert.ifError(err); + assert.strictEqual(data, 'master'); done(); }); }); @@ -139,7 +140,7 @@ describe('oauth', function () { }; oAuth.verifyRequest(req, metadataBackend, function (err, data) { - assert.equal(data, null); + assert.strictEqual(data, null); done(); }); }); @@ -155,7 +156,7 @@ describe('oauth', function () { }; oAuth.verifyRequest(req, metadataBackend, function (err, data) { - assert.equal(data, null); + assert.strictEqual(data, null); done(); }); }); @@ -170,7 +171,7 @@ describe('oauth', function () { it('OAuthAuth reports it has no credentials', function (done) { var req = { query: {}, headers: {} }; var oAuthAuth = new OAuthAuth(req); - assert.equal(oAuthAuth.hasCredentials(), false); + assert.strictEqual(oAuthAuth.hasCredentials(), false); done(); }); }); diff --git a/test/unit/query-info-test.js b/test/unit/query-info-test.js index 715197f9..929d6537 100644 --- a/test/unit/query-info-test.js +++ b/test/unit/query-info-test.js @@ -17,7 +17,7 @@ describe('query info', function () { validQueries.forEach(query => { it(query, function () { const result = queryInfo.getFormatFromCopyQuery(query); - assert.equal(result, 'CSV'); + assert.strictEqual(result, 'CSV'); }); }); }); @@ -31,7 +31,7 @@ describe('query info', function () { validQueries.forEach(query => { it(query, function () { const result = queryInfo.getFormatFromCopyQuery(query); - assert.equal(result, 'TEXT'); + assert.strictEqual(result, 'TEXT'); }); }); }); @@ -44,7 +44,7 @@ describe('query info', function () { validQueries.forEach(query => { it(query, function () { const result = queryInfo.getFormatFromCopyQuery(query); - assert.equal(result, 'BINARY'); + assert.strictEqual(result, 'BINARY'); }); }); });