mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Test: ensure toBuffer tests return any errors
This commit is contained in:
parent
a7003e93c8
commit
d6376c31e0
@ -6,22 +6,19 @@ const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('toBuffer', () => {
|
||||
it('reusing same sharp object does not reset previously passed parameters to toBuffer', (done) => {
|
||||
it('reusing same sharp object does not reset previously passed parameters to toBuffer', async () => {
|
||||
const image = sharp(fixtures.inputJpg);
|
||||
image.toBuffer({ resolveWithObject: true }).then((obj) => {
|
||||
image.toBuffer().then((buff) => {
|
||||
assert.strictEqual(Buffer.isBuffer(buff), true);
|
||||
assert.strictEqual(typeof obj, 'object');
|
||||
done();
|
||||
});
|
||||
});
|
||||
const obj = await image.toBuffer({ resolveWithObject: true });
|
||||
assert.strictEqual(typeof obj, 'object');
|
||||
assert.strictEqual(typeof obj.info, 'object');
|
||||
assert.strictEqual(Buffer.isBuffer(obj.data), true);
|
||||
const data = await image.toBuffer();
|
||||
assert.strictEqual(Buffer.isBuffer(data), true);
|
||||
});
|
||||
|
||||
it('correctly process animated webp with height > 16383', (done) => {
|
||||
const image = sharp(fixtures.inputWebPAnimatedBigHeight, { animated: true });
|
||||
image.toBuffer().then((buff) => {
|
||||
assert.strictEqual(Buffer.isBuffer(buff), true);
|
||||
done();
|
||||
});
|
||||
it('correctly process animated webp with height > 16383', async () => {
|
||||
const data = await sharp(fixtures.inputWebPAnimatedBigHeight, { animated: true })
|
||||
.toBuffer();
|
||||
assert.strictEqual(Buffer.isBuffer(data), true);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user