assert.strictEqual(guessedThumbnailInfoStub.called,false,'When we lack sample URL and original dimensions, GuessedThumbnailInfoProvider is not called');
assert.strictEqual(thumbnailInfoStub.calledOnce,true,'When we lack sample URL and original dimensions, ThumbnailInfoProvider is called once');
assert.strictEqual(imageStub.calledOnce,true,'When we lack sample URL and original dimensions, ImageProvider is called once');
assert.strictEqual(imageStub.calledWith('apiURL'),true,'When we lack sample URL and original dimensions, ImageProvider is called with the API url');
assert.strictEqual(promise.state(),'resolved','When we lack sample URL and original dimensions, fetchThumbnail resolves');
// When the guesser bails out, the classic provider should be used
assert.strictEqual(guessedThumbnailInfoStub.calledOnce,true,'When the guesser returns an URL, but that returns 404, GuessedThumbnailInfoProvider is called once');
assert.strictEqual(thumbnailInfoStub.calledOnce,true,'When the guesser returns an URL, but that returns 404, ThumbnailInfoProvider is called once');
assert.strictEqual(imageStub.calledTwice,true,'When the guesser returns an URL, but that returns 404, ImageProvider is called twice');
assert.strictEqual(imageStub.getCall(0).calledWith('guessedURL'),true,'When the guesser returns an URL, but that returns 404, ImageProvider is called first with the guessed url');
assert.strictEqual(imageStub.getCall(1).calledWith('apiURL'),true,'When the guesser returns an URL, but that returns 404, ImageProvider is called second with the guessed url');
assert.strictEqual(promise.state(),'resolved','When the guesser returns an URL, but that returns 404, fetchThumbnail resolves');
// When even the retry fails, fetchThumbnail() should reject
assert.strictEqual(guessedThumbnailInfoStub.calledOnce,true,'When even the retry fails, GuessedThumbnailInfoProvider is called once');
assert.strictEqual(thumbnailInfoStub.calledOnce,true,'When even the retry fails, ThumbnailInfoProvider is called once');
assert.strictEqual(imageStub.calledTwice,true,'When even the retry fails, ImageProvider is called twice');
assert.strictEqual(imageStub.getCall(0).calledWith('guessedURL'),true,'When even the retry fails, ImageProvider is called first with the guessed url');
assert.strictEqual(imageStub.getCall(1).calledWith('apiURL'),true,'When even the retry fails, ImageProvider is called second with the guessed url');
assert.strictEqual(promise.state(),'rejected','When even the retry fails, fetchThumbnail rejects');
useThumbnailGuessing=false;
// When guessing is disabled, the classic provider is used