mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 12:01:41 +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.
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const assert = require('node:assert');
|
|
|
|
const sharp = require('../../');
|
|
const fixtures = require('../fixtures');
|
|
|
|
describe('Erode', function () {
|
|
it('erode 1 png', function (done) {
|
|
sharp(fixtures.inputPngDotAndLines)
|
|
.erode(1)
|
|
.toBuffer(function (err, data, info) {
|
|
if (err) throw err;
|
|
assert.strictEqual('png', info.format);
|
|
assert.strictEqual(100, info.width);
|
|
assert.strictEqual(100, info.height);
|
|
fixtures.assertSimilar(fixtures.expected('erode-1.png'), data, done);
|
|
});
|
|
});
|
|
|
|
it('erode 1 png - default width', function (done) {
|
|
sharp(fixtures.inputPngDotAndLines)
|
|
.erode()
|
|
.toBuffer(function (err, data, info) {
|
|
if (err) throw err;
|
|
assert.strictEqual('png', info.format);
|
|
assert.strictEqual(100, info.width);
|
|
assert.strictEqual(100, info.height);
|
|
fixtures.assertSimilar(fixtures.expected('erode-1.png'), data, done);
|
|
});
|
|
});
|
|
|
|
it('invalid erosion width', function () {
|
|
assert.throws(function () {
|
|
sharp(fixtures.inputJpg).erode(-1);
|
|
});
|
|
});
|
|
});
|