Add support for Promises/A+ #33

This commit is contained in:
Lovell Fuller
2014-06-01 11:27:30 +01:00
parent 9a05684302
commit 7319533969
4 changed files with 68 additions and 34 deletions

View File

@@ -1,3 +1,7 @@
/*jslint node: true */
/*jslint es5: true */
'use strict';
var sharp = require("../index");
var path = require("path");
var imagemagick = require("imagemagick");
@@ -236,6 +240,18 @@ async.series([
done();
});
});
},
// Promises/A+
function(done) {
sharp(inputJpg).resize(320, 240).toFile(outputJpg).then(function() {
imagemagick.identify(outputJpg, function(err, features) {
assert.strictEqual(320, features.width);
assert.strictEqual(240, features.height);
done();
});
}).catch(function(err) {
throw err;
});
}
]);