diff --git a/src/modules/download/downloadIcon.js b/src/modules/download/downloadIcon.js index 5ad9074..9f55141 100644 --- a/src/modules/download/downloadIcon.js +++ b/src/modules/download/downloadIcon.js @@ -30,7 +30,7 @@ function downloadIcon(iconUrl) { return iconData.then(iconData => { if (!iconData) { - return; + return null; } const fileDetails = fileType(iconData); diff --git a/test/downloadIcons.js b/test/downloadIcons.js index 5f633e9..0705555 100644 --- a/test/downloadIcons.js +++ b/test/downloadIcons.js @@ -7,6 +7,7 @@ const expect = chai.expect; const ICON_URL = 'https://web.whatsapp.com/favicon.ico'; const NOT_ICON_URL = 'http://jiahaog.github.io/nativefier-icons'; +const STATUS_NOT_FOUND_URL = 'http://jiahaog.github.io/nativefier-icons/pleasegivemea404'; const ICON_PATH = path.join(__dirname, '..','out', 'test_icon.ico'); @@ -31,5 +32,14 @@ describe('Download Icons', function() { done(); }) .catch(done); - }) + }); + + it('Will return null if the icon ', function(done) { + downloadIcon(STATUS_NOT_FOUND_URL) + .then(icon => { + expect(icon).to.equal(null, 'Invalid icon should return null'); + done(); + }) + .catch(done); + }); });