diff --git a/test/acceptance/aggregation.js b/test/acceptance/aggregation.js index 904f747c..48232614 100644 --- a/test/acceptance/aggregation.js +++ b/test/acceptance/aggregation.js @@ -6,8 +6,8 @@ const assert = require('../support/assert'); const TestClient = require('../support/test-client'); const serverOptions = require('../../lib/cartodb/server_options'); -const windshaft = require('windshaft'); -const psql_utils = new windshaft.cartodb_utils(); +const windshaftUtils = require('windshaft').utils; +const wmh = new windshaftUtils.WebMercatorHelper(); const suites = [ // { @@ -112,15 +112,15 @@ describe('aggregation', function () { WITH hgrid AS ( SELECT CDB_RectangleGrid ( - ST_Expand(!bbox!, ${psql_utils.cdbXYZResolution(1)} * 12), - ${psql_utils.cdbXYZResolution(1)} * 12, - ${psql_utils.cdbXYZResolution(1)} * 12 + ST_Expand(!bbox!, ${wmh.getResolution({ z : 1 })} * 12), + ${wmh.getResolution({ z : 1 })} * 12, + ${wmh.getResolution({ z : 1 })} * 12 ) as cell ) SELECT hgrid.cell as the_geom_webmercator, count(1) as agg_value, - count(1) /power( 12 * ${psql_utils.cdbXYZResolution(1)}, 2 ) as agg_value_density, + count(1) /power( 12 * ${wmh.getResolution({ z : 1 })}, 2 ) as agg_value_density, row_number() over () as cartodb_id FROM hgrid, (<%= sql %>) i WHERE ST_Intersects(i.the_geom_webmercator, hgrid.cell) GROUP BY hgrid.cell @@ -207,7 +207,7 @@ describe('aggregation', function () { // const POINTS_SQL_GRID = (z, resolution) => ` WITH params AS ( - SELECT ${psql_utils.cdbXYZResolution(z)}*${resolution} AS l -- cell size for Z, resolution + SELECT ${wmh.getResolution({ z : z })}*${resolution} AS l -- cell size for Z, resolution ) SELECT row_number() OVER () AS cartodb_id,