diff --git a/NEWS.md b/NEWS.md index 605dc64e..e917a122 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,7 @@ Announcements: * Support Node.js 10 * Add package-lock.json * Configure Travis CI to run docker tests against Node.js 6 & 10 versions + * Update cartodb-psql to 0.13.1 (type cache depends now on db host) Bug fixes: * Do not use `assert` to throw erros as in Node.js > 6 wraps the original error, the keyword 'throw' does the trick and it's backwards compatible diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index a24b046c..1b3ccc53 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -162,9 +162,9 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz" }, "cartodb-psql": { - "version": "0.13.0", - "from": "cartodb-psql@0.13.0", - "resolved": "https://registry.npmjs.org/cartodb-psql/-/cartodb-psql-0.13.0.tgz", + "version": "0.13.1", + "from": "cartodb-psql@0.13.1", + "resolved": "https://registry.npmjs.org/cartodb-psql/-/cartodb-psql-0.13.1.tgz", "dependencies": { "debug": { "version": "3.2.6", diff --git a/package-lock.json b/package-lock.json index ff7eee75..364e4ac3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -287,9 +287,9 @@ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" }, "cartodb-psql": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/cartodb-psql/-/cartodb-psql-0.13.0.tgz", - "integrity": "sha512-+MBxpgijBgSgXciuwUMGedVB1lABToySoxipODB8YasRc3X15oVSSku9WcMYICnZZg1x2b2Sq4POazBAYoVHxA==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/cartodb-psql/-/cartodb-psql-0.13.1.tgz", + "integrity": "sha512-1z3Dk9G8KQlNGurbcmGBvNj8DVCh1Keue9uzyyvB6hKOYzBHMxixAMG0D+8nSsA7oQmWUsx/xkZZ5ZxT9toEHA==", "requires": { "debug": "^3.1.0", "pg": "github:cartodb/node-postgres#5417d7b29b7272ca2e71bb396899ab3f177a9ae6", @@ -1649,6 +1649,12 @@ } } }, + "mockdate": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mockdate/-/mockdate-2.0.2.tgz", + "integrity": "sha1-WuDA6vj+I+AJzQH5iJtCxPY0rxI=", + "dev": true + }, "moment": { "version": "2.22.2", "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", diff --git a/package.json b/package.json index 5d4160c1..badc0e4c 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "basic-auth": "^2.0.0", "bintrees": "1.0.1", "bunyan": "1.8.1", - "cartodb-psql": "0.13.0", + "cartodb-psql": "0.13.1", "cartodb-query-tables": "0.4.0", "cartodb-redis": "2.1.0", "debug": "2.2.0", @@ -50,6 +50,7 @@ "jshint": "~2.6.0", "libxmljs": "0.19.5", "mocha": "3.2.0", + "mockdate": "^2.0.2", "shapefile": "0.3.0", "sqlite3": "4.0.0", "zipfile": "0.5.11" diff --git a/test/acceptance/last-modified-header.js b/test/acceptance/last-modified-header.js index 0760da64..28799a1b 100644 --- a/test/acceptance/last-modified-header.js +++ b/test/acceptance/last-modified-header.js @@ -5,6 +5,7 @@ require('../helper'); var server = require('../../app/server')(); var assert = require('../support/assert'); var qs = require('querystring'); +var MockDate = require('mockdate'); describe('last modified header', function() { @@ -64,10 +65,7 @@ describe('last modified header', function() { api_key: 1234 }); var fixedDateNow = Date.now(); - var dateNowFn = Date.now; - Date.now = function() { - return fixedDateNow; - }; + MockDate.set(fixedDateNow); assert.response(server, { url: '/api/v1/sql?' + query, @@ -80,7 +78,7 @@ describe('last modified header', function() { statusCode: 200 }, function(err, res) { - Date.now = dateNowFn; + MockDate.reset(); assert.equal(res.headers['last-modified'], new Date(fixedDateNow).toUTCString()); done(); } @@ -93,10 +91,7 @@ describe('last modified header', function() { api_key: 1234 }); var fixedDateNow = Date.now(); - var dateNowFn = Date.now; - Date.now = function() { - return fixedDateNow; - }; + MockDate.set(fixedDateNow); assert.response(server, { url: '/api/v1/sql?' + query, @@ -109,7 +104,7 @@ describe('last modified header', function() { statusCode: 200 }, function(err, res) { - Date.now = dateNowFn; + MockDate.reset(); assert.equal(res.headers['last-modified'], new Date(fixedDateNow).toUTCString()); done(); }