Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33372 from bzbarsky/more-promise-bustage
Browse files Browse the repository at this point in the history
Bug 1228239 - Fix more misuse of Promise static methods in Gaia unit tests
  • Loading branch information
Cwiiis committed Nov 30, 2015
2 parents 05b6e39 + 2fb2ad6 commit 83ab258
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/homescreen/test/unit/apps_test.js
Expand Up @@ -509,15 +509,15 @@ suite('Homescreen app', () => {

test('calls IconsHelper.setElementIcon() on bookmark icons', () => {
var setElementIconStub = sinon.stub(MockIconsHelper, 'setElementIcon',
Promise.resolve);
Promise.resolve.bind(Promise));
app.refreshIcon(mockBookmarkIcon);
assert.isTrue(setElementIconStub.calledOnce);
setElementIconStub.restore();
});

test('calls refresh if setElementIcon() Promise rejects', done => {
var setElementIconStub = sinon.stub(MockIconsHelper, 'setElementIcon',
Promise.reject);
Promise.reject.bind(Promise));
sinon.stub(mockBookmarkIcon, 'refresh', () => {
setElementIconStub.restore();
done();
Expand Down
4 changes: 2 additions & 2 deletions shared/js/icons_helper.js
Expand Up @@ -174,10 +174,10 @@
.then(iconBlob => {
icon.icon = iconBlob;
return Promise.resolve();
}, Promise.reject);
}, Promise.reject.bind(Promise)); // XXXbz Why second arg?
}
return Promise.reject('No icon data found');
}, Promise.reject);
}, Promise.reject.bind(Promise)); // XXXbz Why bother with second arg?
}

function getBestIconFromWebManifest(webManifest, iconSize) {
Expand Down
2 changes: 1 addition & 1 deletion shared/test/unit/mocks/mock_icons_helper.js
Expand Up @@ -22,7 +22,7 @@ var MockIconsHelper = {
});
},

setElementIcon: Promise.resolve,
setElementIcon: Promise.resolve.bind(Promise),

getBestIconFromWebManifest: function() {},
getBestIconFromMetaTags: function() {},
Expand Down

0 comments on commit 83ab258

Please sign in to comment.