Skip to content

Commit

Permalink
Chore: Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press committed Mar 21, 2019
1 parent 19afe6f commit 8f1138d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/lib/viewers/__tests__/BaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,28 @@ describe('lib/viewers/BaseViewer', () => {
sandbox.stub(base, 'emitMetric');
});

it('should trigger an error if we have already retried', () => {
it('should trigger an error if we have already retried', () => {
base.hasRetriedContentDownload = true;
base.handleDownloadError('error', 'https://dl.boxcloud.com');
expect(base.triggerError).to.be.called;
expect(base.load).to.not.be.called;
});

it('should trigger an error if the rep was deleted', () => {
base.hasRetriedContentDownload = false;
base.handleDownloadError(
{
details: {
isRepDeleted: true
}
},
'https://dl.boxcloud.com'
);

expect(base.triggerError).to.be.called;
expect(base.load).to.not.be.called;
});

it('should retry load, and check download reachability if we are on a custom host', () => {
base.hasRetriedContentDownload = false;
DownloadReachability.isCustomDownloadHost.returns(false);
Expand Down

0 comments on commit 8f1138d

Please sign in to comment.