Skip to content

Commit

Permalink
A per nodejs/node#24294, do not depend on .sort() fro asserting results.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgaubert committed May 13, 2020
1 parent 1aac151 commit 830eabb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 35 deletions.
48 changes: 21 additions & 27 deletions test/acceptance/torque-boundaries-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand All @@ -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]
}
]
Expand All @@ -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,
Expand All @@ -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]
}
]
},
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 4 additions & 8 deletions test/acceptance/torque-regressions-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
]);
Expand Down

0 comments on commit 830eabb

Please sign in to comment.