diff options
Diffstat (limited to 'lib/output/modifiers/__tests__/fetchRemoteImages.js')
-rw-r--r-- | lib/output/modifiers/__tests__/fetchRemoteImages.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/output/modifiers/__tests__/fetchRemoteImages.js b/lib/output/modifiers/__tests__/fetchRemoteImages.js new file mode 100644 index 0000000..543aca0 --- /dev/null +++ b/lib/output/modifiers/__tests__/fetchRemoteImages.js @@ -0,0 +1,25 @@ +var cheerio = require('cheerio'); +var tmp = require('tmp'); + +describe('fetchRemoteImages', function() { + var dir; + var fetchRemoteImages = require('../fetchRemoteImages'); + + beforeEach(function() { + dir = tmp.dirSync(); + }); + + pit('should download image file', function() { + var $ = cheerio.load('<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png" />'); + + return fetchRemoteImages(dir.name, $) + .then(function() { + var $img = $('img'); + var src = '.' + $img.attr('src'); + + expect(dir.name).toHaveFile(src); + }); + }); +}); + + |