mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +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');
|
const fixtures = require('../fixtures');
|
||||||
|
|
||||||
describe('toBuffer', () => {
|
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);
|
const image = sharp(fixtures.inputJpg);
|
||||||
image.toBuffer({ resolveWithObject: true }).then((obj) => {
|
const obj = await image.toBuffer({ resolveWithObject: true });
|
||||||
image.toBuffer().then((buff) => {
|
|
||||||
assert.strictEqual(Buffer.isBuffer(buff), true);
|
|
||||||
assert.strictEqual(typeof obj, 'object');
|
assert.strictEqual(typeof obj, 'object');
|
||||||
done();
|
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) => {
|
it('correctly process animated webp with height > 16383', async () => {
|
||||||
const image = sharp(fixtures.inputWebPAnimatedBigHeight, { animated: true });
|
const data = await sharp(fixtures.inputWebPAnimatedBigHeight, { animated: true })
|
||||||
image.toBuffer().then((buff) => {
|
.toBuffer();
|
||||||
assert.strictEqual(Buffer.isBuffer(buff), true);
|
assert.strictEqual(Buffer.isBuffer(data), true);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user