From 43481b42e5845e0af356efaf27b7e7f73144eb10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 26 Dec 2019 17:16:29 +0100 Subject: [PATCH] Eslint errors --- test/acceptance/app-auth-test.js | 1 + test/acceptance/app-configuration-test.js | 24 +++-- test/acceptance/app-test.js | 111 ++++++++++++++-------- test/acceptance/cache-headers-test.js | 6 ++ 4 files changed, 96 insertions(+), 46 deletions(-) diff --git a/test/acceptance/app-auth-test.js b/test/acceptance/app-auth-test.js index c5f6f819..be370e2e 100644 --- a/test/acceptance/app-auth-test.js +++ b/test/acceptance/app-auth-test.js @@ -56,6 +56,7 @@ describe('app.auth', function () { }, {}, function (err, res) { + assert.ifError(err); 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 61c676e6..d0a059d4 100644 --- a/test/acceptance/app-configuration-test.js +++ b/test/acceptance/app-configuration-test.js @@ -24,18 +24,19 @@ describe('app-configuration', function () { statusCode: 200 }; - var expected_cache_control = 'no-cache,max-age=31536000,must-revalidate,public'; - var expected_cache_control_persist = 'public,max-age=31536000'; + var expectedCacheControl = 'no-cache,max-age=31536000,must-revalidate,public'; + var expectedCacheControlPersist = 'public,max-age=31536000'; it('GET /api/v1/version', function (done) { assert.response(server, { url: '/api/v1/version', method: 'GET' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); 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.strictEqual(parsed.cartodb_sql_api, sqlapi_version); + var sqlapiversion = require('../../package.json').version; + assert.ok(Object.prototype.hasOwnProperty.call(parsed, 'cartodb_sql_api'), "No 'cartodb_sql_api' version in " + parsed); + assert.strictEqual(parsed.cartodb_sql_api, sqlapiversion); done(); }); }); @@ -48,6 +49,7 @@ describe('app-configuration', function () { }, { status: 400 }, function (err, res) { + assert.ifError(err); 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'] }); @@ -71,6 +73,7 @@ describe('app-configuration', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); assert.strictEqual( res.headers['access-control-allow-headers'], accessControlHeaders @@ -91,6 +94,7 @@ describe('app-configuration', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'OPTIONS' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); assert.strictEqual(res.body, ''); assert.strictEqual( res.headers['access-control-allow-headers'], @@ -112,11 +116,12 @@ describe('app-configuration', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); // Check cache headers - assert.ok(res.headers.hasOwnProperty('x-cache-channel')); + assert.ok(Object.prototype.hasOwnProperty.call(res.headers, 'x-cache-channel')); // See https://github.com/CartoDB/CartoDB-SQL-API/issues/105 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); + assert.strictEqual(res.headers['cache-control'], expectedCacheControlPersist); done(); }); }); @@ -130,6 +135,7 @@ describe('app-configuration', function () { headers: { host: 'cartodb250user.cartodb.com' }, method: 'GET' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); global.settings.db_host = backupDBHost; try { var parsed = JSON.parse(res.body); @@ -151,6 +157,7 @@ describe('app-configuration', function () { headers: { host: 'cartodb250user.cartodb.com' }, method: 'GET' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); global.settings.db_user_pass = backupDBUserPass; try { assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); @@ -173,9 +180,10 @@ describe('app-configuration', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, RESPONSE_OK, function (err, res) { + assert.ifError(err); // Check cache headers 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['cache-control'], expectedCacheControl); assert.strictEqual(res.headers['access-control-allow-origin'], '*'); assert.strictEqual( res.headers['access-control-allow-headers'], diff --git a/test/acceptance/app-test.js b/test/acceptance/app-test.js index 9103378c..c5ec5f53 100644 --- a/test/acceptance/app-test.js +++ b/test/acceptance/app-test.js @@ -27,8 +27,8 @@ describe('app.test', function () { statusCode: 200 }; - var expected_cache_control = 'no-cache,max-age=31536000,must-revalidate,public'; - var expected_rw_cache_control = 'no-cache,max-age=0,must-revalidate,public'; + var expectedCacheControl = 'no-cache,max-age=31536000,must-revalidate,public'; + var expectedRwCacheControl = 'no-cache,max-age=0,must-revalidate,public'; it('GET /api/v1/sql with SQL parameter on SELECT only. No oAuth included ', function (done) { assert.response(server, { @@ -36,10 +36,11 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); // Check cache headers 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['cache-control'], expectedCacheControl); done(); }); }); @@ -50,6 +51,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); done(); }); @@ -60,25 +62,26 @@ describe('app.test', function () { url: '/user/vizzuality/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4', method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); done(); }); }); - it('GET /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers. Authenticated.', - function (done) { - assert.response(server, { - url: '/api/v1/sql?q=SELECT%20cartodb_id*2%20FROM%20untitle_table_4&api_key=1234', - headers: { host: 'vizzuality.cartodb.com' }, - method: 'GET' - }, { }, function (err, res) { - assert.strictEqual(res.statusCode, 200, res.body); - // Check cache headers - 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(); - }); + it('GET /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers. Authenticated.', function (done) { + assert.response(server, { + url: '/api/v1/sql?q=SELECT%20cartodb_id*2%20FROM%20untitle_table_4&api_key=1234', + headers: { host: 'vizzuality.cartodb.com' }, + method: 'GET' + }, { }, function (err, res) { + assert.ifError(err); + assert.strictEqual(res.statusCode, 200, res.body); + // Check cache headers + assert.strictEqual(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.untitle_table_4'); + assert.strictEqual(res.headers['cache-control'], expectedCacheControl); + done(); }); + }); it('POST /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers', function (done) { assert.response(server, { @@ -87,6 +90,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); done(); }); @@ -100,6 +104,7 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { + assert.ifError(err); 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'); @@ -115,6 +120,7 @@ describe('app.test', function () { method: 'GET' }, { }, function (err, res) { + assert.ifError(err); 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'); @@ -139,6 +145,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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'); @@ -160,6 +167,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.localhost.lan:8080' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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 +183,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); done(); }); }); @@ -193,11 +202,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); done(); }); }); @@ -212,6 +222,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); var parsedBody = JSON.parse(res.body); assert.strictEqual(parsedBody.total_rows, 1); @@ -229,9 +240,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); - assert.ok(!res.hasOwnProperty('x-cache-channel')); - assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); var pbody = JSON.parse(res.body); assert.strictEqual(pbody.rows.length, 0); assert.response(server, { @@ -242,9 +254,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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')); + assert.ok(!Object.prototype.hasOwnProperty.call(res.headers, 'x-cache-channel')); const fallbackTtl = global.settings.cache.fallbackTtl || 300; const cacheControl = res.headers['cache-control']; @@ -270,9 +283,10 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); - assert.ok(!res.hasOwnProperty('x-cache-channel')); - assert.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); var pbody = JSON.parse(res.body); assert.strictEqual(pbody.rows.length, 0); done(); @@ -288,11 +302,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); done(); }); }); @@ -306,11 +321,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); done(); }); }); @@ -324,11 +340,12 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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.strictEqual(res.headers['cache-control'], expected_rw_cache_control); + assert.ok(!Object.prototype.hasOwnProperty.call(res, 'x-cache-channel')); + assert.strictEqual(res.headers['cache-control'], expectedRwCacheControl); done(); }); }); @@ -339,6 +356,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); 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'); @@ -353,6 +371,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); var ct = res.headers['content-type']; assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct); @@ -370,6 +389,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); var ct = res.headers['content-type']; assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct); @@ -386,6 +406,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); var ct = res.headers['content-type']; assert.ok(/json/.test(ct), 'Default format is not JSON: ' + ct); @@ -404,6 +425,7 @@ describe('app.test', function () { }, { status: 400 }, function (err, res) { + assert.ifError(err); var cd = res.headers['access-control-allow-origin']; assert.deepStrictEqual(res.headers['content-type'], 'application/json; charset=utf-8'); assert.deepStrictEqual(res.headers['content-disposition'], 'inline'); @@ -418,6 +440,7 @@ describe('app.test', function () { headers: { host: 'vizzualinot.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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'); @@ -440,6 +463,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); 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'); @@ -491,6 +515,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); assert.strictEqual(_.keys(parsedBody.fields).length, 10); @@ -527,6 +552,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); var row = parsedBody.rows[0]; @@ -568,6 +594,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); try { assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); @@ -588,6 +615,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); try { assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); @@ -608,6 +636,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); try { assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); @@ -628,6 +657,7 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); try { assert.strictEqual(res.statusCode, 200, res.body); var parsedBody = JSON.parse(res.body); @@ -672,7 +702,7 @@ describe('app.test', function () { }, RESPONSE_OK, function (err, res) { try { var parsedBody = JSON.parse(res.body); - assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result'); + assert.ok(Object.prototype.hasOwnProperty.call(parsedBody, 'notices'), 'Missing notices from result'); assert.strictEqual(parsedBody.notices.length, 1); assert.strictEqual(parsedBody.notices[0], 'hello notice'); } catch (e) { @@ -693,7 +723,7 @@ describe('app.test', function () { }, RESPONSE_OK, function (err, res) { try { var parsedBody = JSON.parse(res.body); - assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result'); + assert.ok(Object.prototype.hasOwnProperty.call(parsedBody, 'warnings'), 'Missing warnings from result'); assert.strictEqual(parsedBody.warnings.length, 1); assert.strictEqual(parsedBody.warnings[0], 'hello warning'); } catch (e) { @@ -715,10 +745,10 @@ describe('app.test', function () { }, RESPONSE_OK, function (err, res) { try { var parsedBody = JSON.parse(res.body); - assert.ok(parsedBody.hasOwnProperty('warnings'), 'Missing warnings from result'); + assert.ok(Object.prototype.hasOwnProperty.call(parsedBody, 'warnings'), 'Missing warnings from result'); assert.strictEqual(parsedBody.warnings.length, 1); assert.strictEqual(parsedBody.warnings[0], 'hello again warning'); - assert.ok(parsedBody.hasOwnProperty('notices'), 'Missing notices from result'); + assert.ok(Object.prototype.hasOwnProperty.call(parsedBody, 'notices'), 'Missing notices from result'); assert.strictEqual(parsedBody.notices.length, 1); assert.strictEqual(parsedBody.notices[0], 'hello again notice'); } catch (e) { @@ -754,8 +784,9 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, { }, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.body); - assert.ok(res.body.match(/foo\_jsonp\(.*\)/)); + assert.ok(res.body.match(/foo_jsonp\(.*\)/)); done(); }); }); @@ -766,15 +797,16 @@ describe('app.test', function () { headers: { host: 'vizzuality.cartodb.com' }, method: 'GET' }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.statusCode, 200, res.statusCode + ': ' + res.body); var didRunJsonCallback = false; - // jshint ignore:start + /* eslint-disable */ function foo_jsonp (body) { assert.ok(body.error[0].match(/must be owner of.+? untitle_table_4/)); didRunJsonCallback = true; } eval(res.body); - // jshint ignore:end + /* eslint-enable */ assert.ok(didRunJsonCallback); done(); }); @@ -793,6 +825,7 @@ describe('app.test', function () { } }, function (err, res) { + assert.ifError(err); var error = JSON.parse(res.body); assert.deepStrictEqual(error.error, [ 'You are over platform\'s limits: SQL query timeout error.' + @@ -816,6 +849,7 @@ describe('app.test', function () { } }, function (err, res) { + assert.ifError(err); var error = JSON.parse(res.body); assert.deepStrictEqual(error.error, [ 'You are over platform\'s limits: SQL query timeout error.' + @@ -839,6 +873,7 @@ describe('app.test', function () { } }, function (err, res) { + assert.ifError(err); var error = JSON.parse(res.body); assert.deepStrictEqual(error.error, [ 'You are over platform\'s limits: SQL query timeout error.' + diff --git a/test/acceptance/cache-headers-test.js b/test/acceptance/cache-headers-test.js index dd994df8..e4d96199 100644 --- a/test/acceptance/cache-headers-test.js +++ b/test/acceptance/cache-headers-test.js @@ -18,6 +18,7 @@ describe('cache headers', function () { }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.headers.vary, 'Authorization'); done(); }); @@ -42,6 +43,7 @@ describe('cache headers', function () { }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${noTtl},must-revalidate,public`); assert.response(server, { @@ -55,6 +57,7 @@ describe('cache headers', function () { method: 'GET' }, {}, function (err, res) { + assert.ifError(err); const cacheControl = res.headers['cache-control']; const [, maxAge] = cacheControl.split(','); const [, value] = maxAge.split('='); @@ -72,6 +75,7 @@ describe('cache headers', function () { method: 'GET' }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`); assert.response(server, { @@ -85,6 +89,7 @@ describe('cache headers', function () { method: 'GET' }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`); done(); }); @@ -109,6 +114,7 @@ describe('cache headers', function () { }, {}, function (err, res) { + assert.ifError(err); assert.strictEqual(res.headers['cache-control'], `no-cache,max-age=${ttl},must-revalidate,public`); done(); });