Skip to content

Commit

Permalink
Update errors.spec.js (#718)
Browse files Browse the repository at this point in the history
* Update errors.spec.js

Updating errors.spec.js to use const/let appropriately instead of var.

* Update errors.spec.js

- Changed corrected 'using' to 'use'.
- Changed 'let' to 'const' becuase the're not being changed during the function scope.
  • Loading branch information
PrimeN authored and humphd committed Feb 5, 2019
1 parent b5e1d9a commit 9d4b264
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/spec/errors.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var Filer = require('../../src');
var expect = require('chai').expect;
'use strict';

const Filer = require('../../src');
const expect = require('chai').expect;

describe('Filer.Errors', function() {
it('has expected errors', function() {
Expand Down Expand Up @@ -135,15 +137,15 @@ describe('Filer.Errors', function() {
});

it('should include all expected properties by default', function() {
var 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);
expect(err.message).to.equal('no such file or directory');
});

it('should include extra properties when provided', function() {
var 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);
Expand All @@ -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');
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() {
var 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() {
var 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() {
var 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() {
var 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');
});
Expand Down

0 comments on commit 9d4b264

Please sign in to comment.