sharp/test/unit/toFormat.js
Lovell Fuller b36237ddcb Switch linter from semistandard to biome
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.
2025-09-18 21:18:31 +01:00

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');
});
});