mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 03:51:40 +01:00
Uses the recommended rules apart from complexity/useArrowFunction, which would affect about 1700 lines of code with little benefit right now. This is something that can be addressed over time.
29 lines
820 B
JavaScript
29 lines
820 B
JavaScript
// Copyright 2013 Lovell Fuller and others.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
const assert = require('node:assert');
|
|
const sharp = require('../../');
|
|
const fixtures = require('../fixtures');
|
|
|
|
describe('toFormat', () => {
|
|
it('accepts upper case characters as format parameter (string)', async () => {
|
|
const data = await sharp(fixtures.inputJpg)
|
|
.resize(8, 8)
|
|
.toFormat('PNG')
|
|
.toBuffer();
|
|
|
|
const { format } = await sharp(data).metadata();
|
|
assert.strictEqual(format, 'png');
|
|
});
|
|
|
|
it('accepts upper case characters as format parameter (object)', async () => {
|
|
const data = await sharp(fixtures.inputJpg)
|
|
.resize(8, 8)
|
|
.toFormat({ id: 'PNG' })
|
|
.toBuffer();
|
|
|
|
const { format } = await sharp(data).metadata();
|
|
assert.strictEqual(format, 'png');
|
|
});
|
|
});
|