From 4f1d5f08516771dc4a4083ffcc1adf8173684546 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 16 Aug 2021 15:34:26 -0400 Subject: [PATCH] Similar to e7ad3845f, avoid using finally(done) as it swallows errors --- test/spec/core/locations.js | 21 +++++++++++++++------ test/spec/core/validator.js | 6 ++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/test/spec/core/locations.js b/test/spec/core/locations.js index 230e2de2e..6fa094319 100644 --- a/test/spec/core/locations.js +++ b/test/spec/core/locations.js @@ -43,12 +43,12 @@ describe('iD.coreLocations', function() { var prom = locationManager.mergeLocationSets({}); prom .then(function() { - throw new Error('This was supposed to fail, but somehow succeeded.'); + done(new Error('This was supposed to fail, but somehow succeeded.')); }) .catch(function(err) { expect(/^nothing to do/.test(err)).to.be.true; - }) - .finally(done); + done(); + }); window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs }); @@ -64,8 +64,11 @@ describe('iD.coreLocations', function() { expect(data).to.be.a('array'); expect(data[0].locationSetID).to.eql('+[Q2]'); expect(data[1].locationSetID).to.eql('+[Q30]'); + done(); }) - .finally(done); + .catch(function(err) { + done(err); + }); window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs }); @@ -81,8 +84,11 @@ describe('iD.coreLocations', function() { expect(data).to.be.a('array'); expect(data[0].locationSetID).to.eql('+[Q2]'); expect(data[1].locationSetID).to.eql('+[Q2]'); + done(); }) - .finally(done); + .catch(function(err) { + done(err); + }); window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs }); @@ -139,8 +145,11 @@ describe('iD.coreLocations', function() { expect(result2).to.be.an('object').that.has.all.keys('+[Q2]', '+[Q30]'); var result3 = locationManager.locationsAt([13.575, 41.207,]); // Gaeta expect(result3).to.be.an('object').that.has.all.keys('+[Q2]'); + done(); }) - .finally(done); + .catch(function(err) { + done(err); + }); window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs }); diff --git a/test/spec/core/validator.js b/test/spec/core/validator.js index 8f8fc0cbb..525da71e6 100644 --- a/test/spec/core/validator.js +++ b/test/spec/core/validator.js @@ -40,9 +40,11 @@ describe('iD.coreValidator', function () { expect(issue.type).to.eql('missing_tag'); expect(issue.entityIds).to.have.lengthOf(1); expect(issue.entityIds[0]).to.eql('w-1'); - + done(); }) - .finally(done); + .catch(function(err) { + done(err); + }); window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs });