mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Prevent toFile ext taking precedence over toFormat #1037
This commit is contained in:
@@ -1146,6 +1146,26 @@ describe('Input/output', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('toFormat=JPEG takes precedence over WebP extension', function (done) {
|
||||
sharp(fixtures.inputPng)
|
||||
.jpeg()
|
||||
.toFile(fixtures.outputWebP, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('toFormat=WebP takes precedence over JPEG extension', function (done) {
|
||||
sharp(fixtures.inputPng)
|
||||
.webp()
|
||||
.toFile(fixtures.outputJpg, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('webp', info.format);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('Load GIF from Buffer', function (done) {
|
||||
const inputGifBuffer = fs.readFileSync(fixtures.inputGif);
|
||||
sharp(inputGifBuffer)
|
||||
|
||||
Reference in New Issue
Block a user