From 27d1ff82e38e854fb698e775067c6358ae9b46db Mon Sep 17 00:00:00 2001 From: Paula Stachova Date: Tue, 2 Feb 2016 13:35:59 +0100 Subject: [PATCH] Test added for 404 case --- test/tests.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/tests.js b/test/tests.js index fcef8ae..d341890 100644 --- a/test/tests.js +++ b/test/tests.js @@ -34,6 +34,18 @@ describe('Image download and encode/decode to Base64', function () { done(); }); + it('should report if image could not be loaded', function (done) { + var url = 'http://www.pctools.com/security-news/wp-content/uploads/2011/09/nonExisting404.jpg', options; + + base64Image.base64encoder(url, options, function (err, image) { + err.should.exist; + should.not.exist(image); + + done(); + }); + + }); + it('should download an image and return base64 encoded Buffer', function (done) { this.timeout(15000); @@ -49,6 +61,7 @@ describe('Image download and encode/decode to Base64', function () { }); }); + it('should download an image and return base64 encoded string', function (done) { this.timeout(15000);