|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
require('../support/test_helper');
|
|
|
|
|
|
|
|
|
|
var assert = require('../support/assert');
|
|
|
|
|
var TestClient = require('../support/test-client');
|
|
|
|
|
const LayergroupToken = require('../../lib/cartodb/models/layergroup-token');
|
|
|
|
|
|
|
|
|
|
describe('regressions', function() {
|
|
|
|
|
|
|
|
|
@ -38,6 +38,59 @@ describe('regressions', function() {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('map instantiation', function () {
|
|
|
|
|
const apikeyToken = 'regular1';
|
|
|
|
|
const mapConfig = {
|
|
|
|
|
version: '1.7.0',
|
|
|
|
|
layers: [{
|
|
|
|
|
type: 'cartodb',
|
|
|
|
|
options: {
|
|
|
|
|
sql: 'select * from test_table_localhost_regular1',
|
|
|
|
|
cartocss: TestClient.CARTOCSS.POINTS,
|
|
|
|
|
cartocss_version: '2.3.0'
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
it('should have distint timestamps when the source was updated', function (done) {
|
|
|
|
|
const testClient = new TestClient(mapConfig, apikeyToken);
|
|
|
|
|
|
|
|
|
|
testClient.getLayergroup({}, (err, layergroup) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
return done(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { cacheBuster: cacheBusterA } = LayergroupToken.parse(layergroup.layergroupid);
|
|
|
|
|
|
|
|
|
|
const conn = testClient.getDBConnection();
|
|
|
|
|
|
|
|
|
|
const sql = `select CDB_TableMetadataTouch('test_table_localhost_regular1'::regclass)`;
|
|
|
|
|
|
|
|
|
|
conn.query(sql, (err) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
return done(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testClient.getLayergroup({}, (err, layergroup) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
return done(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { cacheBuster: cacheBusterB } = LayergroupToken.parse(layergroup.layergroupid);
|
|
|
|
|
|
|
|
|
|
const timestampA = parseInt(cacheBusterA, 10);
|
|
|
|
|
const timestampB = parseInt(cacheBusterB, 10);
|
|
|
|
|
|
|
|
|
|
assert.notEqual(timestampA, timestampB);
|
|
|
|
|
assert.ok(timestampA < timestampB, `timestampA: ${timestampA} > timestampB:${timestampB}`);
|
|
|
|
|
|
|
|
|
|
testClient.drain(done);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should create and instantiate a named map with filters', function (done) {
|
|
|
|
|
const apikeyToken = '1234';
|
|
|
|
|
|
|
|
|
|