Expose reoptimise palette option for GIF output

This commit is contained in:
Lovell Fuller
2022-07-12 21:12:31 +01:00
parent d247c02762
commit 6288c7bced
7 changed files with 40 additions and 0 deletions

View File

@@ -80,6 +80,22 @@ describe('GIF input', () => {
assert.strictEqual(true, reduced.length < original.length);
});
it('valid optimise', () => {
assert.doesNotThrow(() => sharp().gif({ reoptimise: true }));
assert.doesNotThrow(() => sharp().gif({ reoptimize: true }));
});
it('invalid reoptimise throws', () => {
assert.throws(
() => sharp().gif({ reoptimise: -1 }),
/Expected boolean for gifReoptimise but received -1 of type number/
);
assert.throws(
() => sharp().gif({ reoptimize: 'fail' }),
/Expected boolean for gifReoptimise but received fail of type string/
);
});
it('invalid loop throws', () => {
assert.throws(() => {
sharp().gif({ loop: -1 });