From 8993cd2a29585b03e00aad1dc00d37e574b2e436 Mon Sep 17 00:00:00 2001 From: Nikola Plesa Date: Fri, 7 Aug 2020 12:48:51 +0200 Subject: [PATCH] fix: update unit tests --- test/spec/services/mapillary.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/spec/services/mapillary.js b/test/spec/services/mapillary.js index e209694fb..9b3eb2de2 100644 --- a/test/spec/services/mapillary.js +++ b/test/spec/services/mapillary.js @@ -54,11 +54,9 @@ describe('iD.serviceMapillary', function() { }); describe('#loadImages', function() { - it.skip('fires loadedImages when images are loaded', function(done) { - mapillary.on('loadedImages', function() { - expect(server.requests().length).to.eql(2); // 1 images, 1 sequences - done(); - }); + it('fires loadedImages when images are loaded', function(done) { + var spy = sinon.spy(); + mapillary.on('loadedImages', spy); mapillary.loadImages(context.projection); @@ -72,6 +70,11 @@ describe('iD.serviceMapillary', function() { server.respondWith('GET', /images/, [200, { 'Content-Type': 'application/json' }, JSON.stringify(response) ]); server.respond(); + window.setTimeout(function() { + expect(spy).to.have.been.called; + expect(server.requests().length).to.eql(2); + done(); + }, 500); }); it('does not load images around null island', function(done) { @@ -266,7 +269,7 @@ describe('iD.serviceMapillary', function() { expect(spy).to.have.been.called; expect(server.requests().length).to.eql(1); done(); - }, 200); + }, 500); }); });