mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Linter: apply all recommended biome settings
Enforces previously-skipped useArrowFunction check
This commit is contained in:
@@ -9,15 +9,15 @@ const assert = require('node:assert');
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Colour space conversion', function () {
|
||||
it('To greyscale', function (_t, done) {
|
||||
describe('Colour space conversion', () => {
|
||||
it('To greyscale', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.greyscale()
|
||||
.toFile(fixtures.path('output.greyscale-gamma-0.0.jpg'), done);
|
||||
});
|
||||
|
||||
it('To greyscale with gamma correction', function (_t, done) {
|
||||
it('To greyscale with gamma correction', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.gamma()
|
||||
@@ -25,19 +25,19 @@ describe('Colour space conversion', function () {
|
||||
.toFile(fixtures.path('output.greyscale-gamma-2.2.jpg'), done);
|
||||
});
|
||||
|
||||
it('Not to greyscale', function (_t, done) {
|
||||
it('Not to greyscale', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.greyscale(false)
|
||||
.toFile(fixtures.path('output.greyscale-not.jpg'), done);
|
||||
});
|
||||
|
||||
it('Greyscale with single channel output', function (_t, done) {
|
||||
it('Greyscale with single channel output', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.greyscale()
|
||||
.toColourspace('b-w')
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(1, info.channels);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -56,10 +56,10 @@ describe('Colour space conversion', function () {
|
||||
assert.strictEqual(format, 'webp');
|
||||
});
|
||||
|
||||
it('From CMYK to sRGB', function (_t, done) {
|
||||
it('From CMYK to sRGB', (_t, done) => {
|
||||
sharp(fixtures.inputJpgWithCmykProfile)
|
||||
.resize(320)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
@@ -68,13 +68,13 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('From CMYK to sRGB with white background, not yellow', function (_t, done) {
|
||||
it('From CMYK to sRGB with white background, not yellow', (_t, done) => {
|
||||
sharp(fixtures.inputJpgWithCmykProfile)
|
||||
.resize(320, 240, {
|
||||
fit: sharp.fit.contain,
|
||||
background: 'white'
|
||||
})
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -83,10 +83,10 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('From profile-less CMYK to sRGB', function (_t, done) {
|
||||
it('From profile-less CMYK to sRGB', (_t, done) => {
|
||||
sharp(fixtures.inputJpgWithCmykNoProfile)
|
||||
.resize(320)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -130,7 +130,7 @@ describe('Colour space conversion', function () {
|
||||
.pipelineColourspace('cmyk')
|
||||
.withIccProfile(fixtures.path('XCMYK 2017.icc'))
|
||||
.negate()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('tiff', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -144,13 +144,13 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('From sRGB with RGB16 pipeline, resize with gamma, to sRGB', function (_t, done) {
|
||||
it('From sRGB with RGB16 pipeline, resize with gamma, to sRGB', (_t, done) => {
|
||||
sharp(fixtures.inputPngGradients)
|
||||
.pipelineColourspace('rgb16')
|
||||
.resize(320)
|
||||
.gamma()
|
||||
.toColourspace('srgb')
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(320, info.width);
|
||||
fixtures.assertSimilar(fixtures.expected('colourspace-gradients-gamma-resize.png'), data, {
|
||||
@@ -178,15 +178,15 @@ describe('Colour space conversion', function () {
|
||||
assert.strictEqual(b, 34);
|
||||
});
|
||||
|
||||
it('Invalid pipelineColourspace input', function () {
|
||||
assert.throws(function () {
|
||||
it('Invalid pipelineColourspace input', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.pipelineColorspace(null);
|
||||
}, /Expected string for colourspace but received null of type object/);
|
||||
});
|
||||
|
||||
it('Invalid toColourspace input', function () {
|
||||
assert.throws(function () {
|
||||
it('Invalid toColourspace input', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.toColourspace(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user