Files
Lovell Fuller 7e9b350e22 Modernise all unit tests
- Ensure all tests have an expected assertion count
- Ensure all tests have at least one assertion
- Use async/await unless test is callback-specific
2026-05-20 21:57:40 +01:00

34 lines
870 B
JavaScript

/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
const { suite, test } = require('node:test');
const sharp = require('../../');
const fixtures = require('../fixtures');
suite('toFormat', () => {
test('accepts upper case characters as format parameter (string)', async (t) => {
t.plan(1);
const data = await sharp(fixtures.inputJpg)
.resize(8, 8)
.toFormat('PNG')
.toBuffer();
const { format } = await sharp(data).metadata();
t.assert.strictEqual(format, 'png');
});
test('accepts upper case characters as format parameter (object)', async (t) => {
t.plan(1);
const data = await sharp(fixtures.inputJpg)
.resize(8, 8)
.toFormat({ id: 'PNG' })
.toBuffer();
const { format } = await sharp(data).metadata();
t.assert.strictEqual(format, 'png');
});
});