From 0fdab08600a3ed68e3893dfc43cf801c41cd15e7 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Thu, 14 Dec 2017 16:54:53 +0100 Subject: [PATCH] Torque boundaries tests: Sort objects before comparison Order is not guaranteed by torque and changed behaviour from PG 9.5 to 10 --- NEWS.md | 3 ++- test/acceptance/ported/torque_boundaries.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6e4f94b1..6569f3e7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,8 @@ Released 2018-01-04 New features: - Return url template in metadata #838. +Bux fixes: + - Tests: Order torque objects before comparison ## 4.7.0 Released 2018-01-03 @@ -30,7 +32,6 @@ Announcements: - Fix column names collisions in histograms [#828](https://github.com/CartoDB/Windshaft-cartodb/pull/828). - Add full-sample aggregation support for vector map-config. - ## 4.5.0 Released 2017-12-19 diff --git a/test/acceptance/ported/torque_boundaries.js b/test/acceptance/ported/torque_boundaries.js index a984389d..9b4619b1 100644 --- a/test/acceptance/ported/torque_boundaries.js +++ b/test/acceptance/ported/torque_boundaries.js @@ -257,6 +257,14 @@ describe('torque boundary points', function() { assert.equal(res.statusCode, 200, res.body); assert.equal(res.headers['content-type'], "application/json; charset=utf-8"); var parsed = JSON.parse(res.body); + /* Order the JSON first by descending x__uint8 and ascending + * y__uint8 */ + parsed.sort(function(a,b) { + if (a.x__uint8 === b.x__uint8) { + return (a.y__uint8 > b.y__uint8); + } + return (a.x__uint8 < b.x__uint8); + }); var i = 0; tileRequest.expects.forEach(function(expected) { @@ -424,7 +432,7 @@ describe('torque boundary points', function() { var parsed = JSON.parse(res.body); - assert.deepEqual(parsed, [ + assert.deepEqual(parsed.sort(function(a,b){return a.x__uint8 > b.x__uint8;}), [ { x__uint8: 47, y__uint8: 127, @@ -438,7 +446,6 @@ describe('torque boundary points', function() { dates__uint16: [0] } ]); - done(); }); });