From 830eabbb1d441e68aad7c55cfd8925a079dd7134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 13 May 2020 11:29:08 +0200 Subject: [PATCH] A per https://github.com/nodejs/node/issues/24294, do not depend on .sort() fro asserting results. --- test/acceptance/torque-boundaries-test.js | 48 ++++++++++------------ test/acceptance/torque-regressions-test.js | 12 ++---- 2 files changed, 25 insertions(+), 35 deletions(-) diff --git a/test/acceptance/torque-boundaries-test.js b/test/acceptance/torque-boundaries-test.js index 33c4ac536..f4fcc0d8c 100644 --- a/test/acceptance/torque-boundaries-test.js +++ b/test/acceptance/torque-boundaries-test.js @@ -76,29 +76,29 @@ describe('torque boundary points', function () { y: 0, expects: [ { - x__uint8: 255, - y__uint8: 128, + x__uint8: 128, + y__uint8: 255, vals__uint8: [{ v: 2, - d: 'i=9 and i=11' + d: 'i=10 and i=12' }], dates__uint16: [0] }, { - x__uint8: 128, + x__uint8: 255, y__uint8: 128, vals__uint8: [{ - v: 8, - d: 'i=[1..8]' + v: 2, + d: 'i=9 and i=11' }], dates__uint16: [0] }, { x__uint8: 128, - y__uint8: 255, + y__uint8: 128, vals__uint8: [{ - v: 2, - d: 'i=10 and i=12' + v: 8, + d: 'i=[1..8]' }], dates__uint16: [0] } @@ -117,20 +117,20 @@ describe('torque boundary points', function () { expects: [ { x__uint8: 255, - y__uint8: 0, - vals__uint8: [{ v: 2, d: 'i=6 (-r1,r1) and i=7(-r1/2,r1)' }], + y__uint8: 255, + vals__uint8: [{ v: 2, d: 'i=10 and i=12' }], dates__uint16: [0] }, { x__uint8: 255, - y__uint8: 1, - vals__uint8: [{ v: 2, d: 'i=1 and i=3' }], + y__uint8: 0, + vals__uint8: [{ v: 2, d: 'i=6 (-r1,r1) and i=7(-r1/2,r1)' }], dates__uint16: [0] }, { x__uint8: 255, - y__uint8: 255, - vals__uint8: [{ v: 2, d: 'i=10 and i=12' }], + y__uint8: 1, + vals__uint8: [{ v: 2, d: 'i=1 and i=3' }], dates__uint16: [0] } ] @@ -146,6 +146,12 @@ describe('torque boundary points', function () { x: 1, y: 0, expects: [ + { + x__uint8: 0, + y__uint8: 255, + vals__uint8: [{ v: 2, d: 'i=10 and i=12' }], + dates__uint16: [0] + }, { x__uint8: 255, y__uint8: 0, @@ -157,12 +163,6 @@ describe('torque boundary points', function () { y__uint8: 0, vals__uint8: [{ v: 2, d: 'i=1 and i=5' }], dates__uint16: [0] - }, - { - x__uint8: 0, - y__uint8: 255, - vals__uint8: [{ v: 2, d: 'i=10 and i=12' }], - dates__uint16: [0] } ] }, @@ -229,12 +229,6 @@ describe('torque boundary points', function () { testClient.getTile(z, x, y, { layer: 0, format: 'torque.json' }, function (err, torqueTile) { assert.ifError(err); var i = 0; - torqueTile.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); - }); tileRequest.expects.forEach(function (expected) { assert.equal( torqueTile[i].x__uint8, diff --git a/test/acceptance/torque-regressions-test.js b/test/acceptance/torque-regressions-test.js index 9fe5277ea..617b5d91b 100644 --- a/test/acceptance/torque-regressions-test.js +++ b/test/acceptance/torque-regressions-test.js @@ -80,21 +80,17 @@ describe('torque regression', function () { var testClient = new TestClient(resolutionTwoMapConfig); testClient.getTile(13, 4255, 2765, { layer: 0, format: 'torque.json' }, function (err, torqueTile) { assert.ifError(err); - /* Sort torqueTile with x___uint8 ascending */ - torqueTile.sort(function (a, b) { - return (a.x__uint8 > b.x__uint8); - }); assert.deepEqual(torqueTile, [ { - x__uint8: 47, + x__uint8: 48, y__uint8: 127, - vals__uint8: [2], + vals__uint8: [1], dates__uint16: [0] }, { - x__uint8: 48, + x__uint8: 47, y__uint8: 127, - vals__uint8: [1], + vals__uint8: [2], dates__uint16: [0] } ]);