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,12 +9,12 @@ const assert = require('node:assert');
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Threshold', function () {
|
||||
it('threshold 1 jpeg', function (_t, done) {
|
||||
describe('Threshold', () => {
|
||||
it('threshold 1 jpeg', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(1)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -23,11 +23,11 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold 40 jpeg', function (_t, done) {
|
||||
it('threshold 40 jpeg', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(40)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -36,11 +36,11 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold 128', function (_t, done) {
|
||||
it('threshold 128', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(128)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -49,11 +49,11 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold true (=128)', function (_t, done) {
|
||||
it('threshold true (=128)', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(true)
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -62,20 +62,20 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold false (=0)', function (_t, done) {
|
||||
it('threshold false (=0)', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.threshold(false)
|
||||
.toBuffer(function (err, data) {
|
||||
.toBuffer((err, data) => {
|
||||
if (err) throw err;
|
||||
fixtures.assertSimilar(fixtures.inputJpg, data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold grayscale: true (=128)', function (_t, done) {
|
||||
it('threshold grayscale: true (=128)', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(128, { grayscale: true })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -84,11 +84,11 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold default jpeg', function (_t, done) {
|
||||
it('threshold default jpeg', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -97,11 +97,11 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold default png transparency', function (_t, done) {
|
||||
it('threshold default png transparency', (_t, done) => {
|
||||
sharp(fixtures.inputPngWithTransparency)
|
||||
.resize(320, 240)
|
||||
.threshold()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -110,11 +110,11 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold default png alpha', function (_t, done) {
|
||||
it('threshold default png alpha', (_t, done) => {
|
||||
sharp(fixtures.inputPngWithGreyAlpha)
|
||||
.resize(320, 240)
|
||||
.threshold()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -123,21 +123,21 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('threshold default webp transparency', function (_t, done) {
|
||||
it('threshold default webp transparency', (_t, done) => {
|
||||
sharp(fixtures.inputWebPWithTransparency)
|
||||
.threshold()
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('webp', info.format);
|
||||
fixtures.assertSimilar(fixtures.expected('threshold-128-transparency.webp'), data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('color threshold', function (_t, done) {
|
||||
it('color threshold', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.threshold(128, { grayscale: false })
|
||||
.toBuffer(function (err, data, info) {
|
||||
.toBuffer((err, data, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
@@ -146,14 +146,14 @@ describe('Threshold', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('invalid threshold -1', function () {
|
||||
assert.throws(function () {
|
||||
it('invalid threshold -1', () => {
|
||||
assert.throws(() => {
|
||||
sharp().threshold(-1);
|
||||
});
|
||||
});
|
||||
|
||||
it('invalid threshold 256', function () {
|
||||
assert.throws(function () {
|
||||
it('invalid threshold 256', () => {
|
||||
assert.throws(() => {
|
||||
sharp().threshold(256);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user