From a1cddb64a1dc28331b4ca89a924b2acb93b582f8 Mon Sep 17 00:00:00 2001 From: PrimeN Date: Wed, 30 Jan 2019 13:27:04 -0500 Subject: [PATCH 1/2] Update errors.spec.js Updating errors.spec.js to use const/let appropriately instead of var. --- tests/spec/errors.spec.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/spec/errors.spec.js b/tests/spec/errors.spec.js index 1d6e5bb2..45305d5c 100644 --- a/tests/spec/errors.spec.js +++ b/tests/spec/errors.spec.js @@ -1,5 +1,7 @@ -var Filer = require('../../src'); -var expect = require('chai').expect; +'using strict'; + +const Filer = require('../../src'); +const expect = require('chai').expect; describe('Filer.Errors', function() { it('has expected errors', function() { @@ -135,7 +137,7 @@ describe('Filer.Errors', function() { }); it('should include all expected properties by default', function() { - var err = new Filer.Errors.ENOENT(); + let err = new Filer.Errors.ENOENT(); expect(err.name).to.equal('ENOENT'); expect(err.code).to.equal('ENOENT'); expect(err.errno).to.equal(34); @@ -143,7 +145,7 @@ describe('Filer.Errors', function() { }); it('should include extra properties when provided', function() { - var err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); + let err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); expect(err.name).to.equal('ENOENT'); expect(err.code).to.equal('ENOENT'); expect(err.errno).to.equal(34); @@ -152,29 +154,29 @@ describe('Filer.Errors', function() { }); it('should include default message and path info when provided', function() { - var err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); + let err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); expect(err.message).to.equal('no such file or directory'); expect(err.path).to.equal('/this/is/the/path'); }); it('should include just the message when no path provided', function() { - var err = new Filer.Errors.ENOENT(); + let err = new Filer.Errors.ENOENT(); expect(err.message).to.equal('no such file or directory'); expect(err.path).not.to.exist; }); it('should not include path in toString() when not provided', function() { - var err = new Filer.Errors.ENOENT('This is the message'); + let err = new Filer.Errors.ENOENT('This is the message'); expect(err.toString()).to.equal('ENOENT: This is the message'); }); it('should include path in toString() when provided', function() { - var err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); + let err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); expect(err.toString()).to.equal('ENOENT: no such file or directory, \'/this/is/the/path\''); }); it('should include message and path info when provided', function() { - var err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); + let err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); expect(err.message).to.equal('This is the message'); expect(err.path).to.equal('/this/is/the/path'); }); From 7c9374d3ce5b272056033507cbf76f3586037293 Mon Sep 17 00:00:00 2001 From: PrimeN Date: Wed, 30 Jan 2019 14:37:08 -0500 Subject: [PATCH 2/2] Update errors.spec.js - Changed corrected 'using' to 'use'. - Changed 'let' to 'const' becuase the're not being changed during the function scope. --- tests/spec/errors.spec.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/spec/errors.spec.js b/tests/spec/errors.spec.js index 45305d5c..65061ff6 100644 --- a/tests/spec/errors.spec.js +++ b/tests/spec/errors.spec.js @@ -1,4 +1,4 @@ -'using strict'; +'use strict'; const Filer = require('../../src'); const expect = require('chai').expect; @@ -137,7 +137,7 @@ describe('Filer.Errors', function() { }); it('should include all expected properties by default', function() { - let err = new Filer.Errors.ENOENT(); + const err = new Filer.Errors.ENOENT(); expect(err.name).to.equal('ENOENT'); expect(err.code).to.equal('ENOENT'); expect(err.errno).to.equal(34); @@ -145,7 +145,7 @@ describe('Filer.Errors', function() { }); it('should include extra properties when provided', function() { - let err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); + const err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); expect(err.name).to.equal('ENOENT'); expect(err.code).to.equal('ENOENT'); expect(err.errno).to.equal(34); @@ -154,29 +154,29 @@ describe('Filer.Errors', function() { }); it('should include default message and path info when provided', function() { - let err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); + const err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); expect(err.message).to.equal('no such file or directory'); expect(err.path).to.equal('/this/is/the/path'); }); it('should include just the message when no path provided', function() { - let err = new Filer.Errors.ENOENT(); + const err = new Filer.Errors.ENOENT(); expect(err.message).to.equal('no such file or directory'); expect(err.path).not.to.exist; }); it('should not include path in toString() when not provided', function() { - let err = new Filer.Errors.ENOENT('This is the message'); + const err = new Filer.Errors.ENOENT('This is the message'); expect(err.toString()).to.equal('ENOENT: This is the message'); }); it('should include path in toString() when provided', function() { - let err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); + const err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); expect(err.toString()).to.equal('ENOENT: no such file or directory, \'/this/is/the/path\''); }); it('should include message and path info when provided', function() { - let err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); + const err = new Filer.Errors.ENOENT('This is the message', '/this/is/the/path'); expect(err.message).to.equal('This is the message'); expect(err.path).to.equal('/this/is/the/path'); });