mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Let libvips check whether we received a valid image or not
This removes the custom image fingerprinting code and uses the libvips is_a_buffer() infrastructure instead.
This commit is contained in:
@@ -202,27 +202,23 @@ describe('Input/output', function() {
|
||||
});
|
||||
|
||||
it('Fail when input is empty Buffer', function(done) {
|
||||
var failed = true;
|
||||
try {
|
||||
sharp(new Buffer(0));
|
||||
failed = false;
|
||||
} catch (err) {
|
||||
sharp(new Buffer(0)).toBuffer().then(function () {
|
||||
assert(false);
|
||||
done();
|
||||
}).catch(function (err) {
|
||||
assert(err instanceof Error);
|
||||
}
|
||||
assert(failed);
|
||||
done();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('Fail when input is invalid Buffer', function(done) {
|
||||
var failed = true;
|
||||
try {
|
||||
sharp(new Buffer([0x1, 0x2, 0x3, 0x4]));
|
||||
failed = false;
|
||||
} catch (err) {
|
||||
sharp(new Buffer([0x1, 0x2, 0x3, 0x4])).toBuffer().then(function () {
|
||||
assert(false);
|
||||
done();
|
||||
}).catch(function (err) {
|
||||
assert(err instanceof Error);
|
||||
}
|
||||
assert(failed);
|
||||
done();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('Promises/A+', function(done) {
|
||||
|
||||
Reference in New Issue
Block a user