-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
const LesshintError = require('../../../lib/errors/lesshint-error'); | ||
const expect = require('chai').expect; | ||
const path = require('path'); | ||
|
||
describe('LesshintError', function () { | ||
it('should handle an Error object', function () { | ||
const message = 'Something went wrong'; | ||
const error = new Error(message); | ||
|
||
const lesshintError = new LesshintError(error, '/path/to/file.less'); | ||
|
||
expect(lesshintError.message).to.equal(message); | ||
}); | ||
|
||
it('should handle a a string', function () { | ||
const message = 'Something went wrong'; | ||
|
||
const lesshintError = new LesshintError(message, '/path/to/file.less'); | ||
|
||
expect(lesshintError.message).to.equal(message); | ||
}); | ||
|
||
it('should resolve paths', function () { | ||
const file = 'file.less'; | ||
const errorPath = path.resolve(process.cwd(), file); | ||
|
||
const lesshintError = new LesshintError('Something went wrong', file); | ||
|
||
expect(lesshintError.path).to.equal(errorPath); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
const RunnerError = require('../../../lib/errors/runner-error'); | ||
const expect = require('chai').expect; | ||
|
||
describe('RunnerError', function () { | ||
it('should handle an Error object', function () { | ||
const message = 'Something went wrong'; | ||
const error = new Error(message); | ||
|
||
const runnerError = new RunnerError(error, 1); | ||
|
||
expect(runnerError.message).to.equal(message); | ||
}); | ||
|
||
it('should handle a a string', function () { | ||
const message = 'Something went wrong'; | ||
|
||
const runnerError = new RunnerError(message, 1); | ||
|
||
expect(runnerError.message).to.equal(message); | ||
}); | ||
|
||
it('should set the status', function () { | ||
const status = 1; | ||
const runnerError = new RunnerError('Something went wrong', status); | ||
|
||
expect(runnerError.status).to.equal(status); | ||
}); | ||
}); |