From 2e7174357855578297feb6dc8a109d9ad7ef97b5 Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Wed, 22 Nov 2017 09:38:47 -0800 Subject: [PATCH] Fix: Remove unhandled errors from unit tests (#498) --- .../__tests__/Image360Renderer-test.js | 4 ---- .../doc/__tests__/DocBaseViewer-test.js | 24 +++++++++---------- .../media/__tests__/MediaBaseViewer-test.js | 3 ++- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/lib/viewers/box3d/image360/__tests__/Image360Renderer-test.js b/src/lib/viewers/box3d/image360/__tests__/Image360Renderer-test.js index fa0bcc2a2..06d0abc97 100644 --- a/src/lib/viewers/box3d/image360/__tests__/Image360Renderer-test.js +++ b/src/lib/viewers/box3d/image360/__tests__/Image360Renderer-test.js @@ -238,10 +238,6 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => { }); }); - describe('loadPanoramaFile()', () => { - it('should have @jholdstock implement this test after @mbond gets 3D image representations in prod'); - }); - describe('enableVr()', () => { beforeEach(() => { // We don't care about super calls :D diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index b37d2f9ef..477a956d3 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -749,12 +749,12 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { docBase.isMobile = false; sandbox.stub(PDFJS, 'getDocument').returns(Promise.resolve({})); - docBase.initViewer(''); - - expect(stubs.pdfViewerStub).to.be.calledWith({ - container: sinon.match.any, - linkService: sinon.match.any, - enhanceTextSelection: true + return docBase.initViewer('').then(() => { + expect(stubs.pdfViewerStub).to.be.calledWith({ + container: sinon.match.any, + linkService: sinon.match.any, + enhanceTextSelection: true + }); }); }); @@ -765,12 +765,12 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { docBase.isMobile = true; sandbox.stub(PDFJS, 'getDocument').returns(Promise.resolve({})); - docBase.initViewer(''); - - expect(stubs.pdfViewerStub).to.be.calledWith({ - container: sinon.match.any, - linkService: sinon.match.any, - enhanceTextSelection: false + return docBase.initViewer('').then(() => { + expect(stubs.pdfViewerStub).to.be.calledWith({ + container: sinon.match.any, + linkService: sinon.match.any, + enhanceTextSelection: false + }); }); }); diff --git a/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js b/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js index 529d7cf98..785d9cd38 100644 --- a/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js +++ b/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js @@ -179,8 +179,9 @@ describe('lib/viewers/media/MediaBaseViewer', () => { describe('errorHandler', () => { it('should emit the error and set a display message', () => { sandbox.stub(media, 'emit'); - const err = new Error('blah'); + sandbox.mock(window.console).expects('error').withArgs(err); + media.errorHandler(err); err.displayMessage = 'We\'re sorry, the preview didn\'t load. Please refresh the page.';