Update tests to meet semistandard code standards

Switch to const/let instead of var
This commit is contained in:
Lovell Fuller
2016-10-26 11:52:45 +01:00
parent 36e636dca1
commit cbdbbe535a
38 changed files with 1378 additions and 1405 deletions

View File

@@ -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);
});
});