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,17 +1,16 @@
'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('Image channel extraction', function() {
it('Red channel', function(done) {
describe('Image channel extraction', function () {
it('Red channel', function (done) {
sharp(fixtures.inputJpg)
.extractChannel('red')
.resize(320,240)
.toBuffer(function(err, data, info) {
.resize(320, 240)
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
@@ -19,11 +18,11 @@ describe('Image channel extraction', function() {
});
});
it('Green channel', function(done) {
it('Green channel', function (done) {
sharp(fixtures.inputJpg)
.extractChannel('green')
.resize(320,240)
.toBuffer(function(err, data, info) {
.resize(320, 240)
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
@@ -31,11 +30,11 @@ describe('Image channel extraction', function() {
});
});
it('Blue channel', function(done) {
it('Blue channel', function (done) {
sharp(fixtures.inputJpg)
.extractChannel('blue')
.resize(320,240)
.toBuffer(function(err, data, info) {
.resize(320, 240)
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
@@ -43,11 +42,11 @@ describe('Image channel extraction', function() {
});
});
it('Blue channel by number', function(done) {
it('Blue channel by number', function (done) {
sharp(fixtures.inputJpg)
.extractChannel(2)
.resize(320,240)
.toBuffer(function(err, data, info) {
.resize(320, 240)
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
@@ -55,27 +54,26 @@ describe('Image channel extraction', function() {
});
});
it('Invalid channel number', function() {
assert.throws(function() {
it('Invalid channel number', function () {
assert.throws(function () {
sharp(fixtures.inputJpg)
.extractChannel(-1);
});
});
it('No arguments', function() {
assert.throws(function() {
it('No arguments', function () {
assert.throws(function () {
sharp(fixtures.inputJpg)
.extractChannel();
});
});
it('Non-existant channel', function(done) {
it('Non-existant channel', function (done) {
sharp(fixtures.inputPng)
.extractChannel(1)
.toBuffer(function(err) {
.toBuffer(function (err) {
assert(err instanceof Error);
done();
});
});
});