mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Update tests to meet semistandard code standards
Switch to const/let instead of var
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
const assert = require('assert');
|
||||
|
||||
var sharp = require('../../index');
|
||||
var fixtures = require('../fixtures');
|
||||
const sharp = require('../../index');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Trim borders', function() {
|
||||
|
||||
it('Threshold default', function(done) {
|
||||
var expected = fixtures.expected('alpha-layer-1-fill-trim-resize.png');
|
||||
describe('Trim borders', function () {
|
||||
it('Threshold default', function (done) {
|
||||
const expected = fixtures.expected('alpha-layer-1-fill-trim-resize.png');
|
||||
sharp(fixtures.inputPngOverlayLayer1)
|
||||
.resize(450, 322)
|
||||
.trim()
|
||||
.toBuffer(function(err, data, info) {
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(450, info.width);
|
||||
@@ -21,11 +20,11 @@ describe('Trim borders', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('16-bit PNG with alpha channel', function(done) {
|
||||
it('16-bit PNG with alpha channel', function (done) {
|
||||
sharp(fixtures.inputPngWithTransparency16bit)
|
||||
.resize(32, 32)
|
||||
.trim(20)
|
||||
.toBuffer(function(err, data, info) {
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('png', info.format);
|
||||
@@ -36,10 +35,10 @@ describe('Trim borders', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Invalid thresholds', function() {
|
||||
[-1, 100, 'fail', {}].forEach(function(threshold) {
|
||||
it(JSON.stringify(threshold), function() {
|
||||
assert.throws(function() {
|
||||
describe('Invalid thresholds', function () {
|
||||
[-1, 100, 'fail', {}].forEach(function (threshold) {
|
||||
it(JSON.stringify(threshold), function () {
|
||||
assert.throws(function () {
|
||||
sharp().trim(threshold);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user