Ensure all WebP tests wait until Promises resolve

This commit is contained in:
Lovell Fuller 2019-07-29 11:32:31 +01:00
parent 76ded7fd28
commit ba4ce75377

View File

@ -81,15 +81,15 @@ describe('WebP', function () {
.resize(320, 240) .resize(320, 240)
.webp({ smartSubsample: false }) .webp({ smartSubsample: false })
.toBuffer() .toBuffer()
.then(withoutSmartSubsample => { .then(withoutSmartSubsample =>
sharp(fixtures.inputJpg) sharp(fixtures.inputJpg)
.resize(320, 240) .resize(320, 240)
.webp({ smartSubsample: true }) .webp({ smartSubsample: true })
.toBuffer() .toBuffer()
.then(withSmartSubsample => { .then(withSmartSubsample => {
assert.strictEqual(true, withSmartSubsample.length > withoutSmartSubsample.length); assert.strictEqual(true, withSmartSubsample.length > withoutSmartSubsample.length);
});
}) })
)
); );
it('invalid smartSubsample throws', () => { it('invalid smartSubsample throws', () => {
@ -103,15 +103,15 @@ describe('WebP', function () {
.resize(320, 240) .resize(320, 240)
.webp() .webp()
.toBuffer() .toBuffer()
.then(reductionEffort4 => { .then(reductionEffort4 =>
sharp(fixtures.inputJpg) sharp(fixtures.inputJpg)
.resize(320, 240) .resize(320, 240)
.webp({ reductionEffort: 6 }) .webp({ reductionEffort: 6 })
.toBuffer() .toBuffer()
.then(reductionEffort6 => { .then(reductionEffort6 => {
assert.strictEqual(true, reductionEffort4.length > reductionEffort6.length); assert.strictEqual(true, reductionEffort4.length > reductionEffort6.length);
});
}) })
)
); );
it('invalid reductionEffort throws', () => { it('invalid reductionEffort throws', () => {