Skip to content

Commit 36bdb6b

Browse files
Added a test for invalid file path
1 parent 1891b06 commit 36bdb6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/specs/invalid/invalid.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ describe('Invalid syntax', function () {
22
'use strict';
33

44
describe('in main file', function () {
5+
it('should throw an error for an invalid file path', function () {
6+
return $RefParser
7+
.dereference('this file does not exist')
8+
.then(helper.shouldNotGetCalled)
9+
.catch(function (err) {
10+
expect(err).to.be.an.instanceOf(Error);
11+
expect(err.code).to.equal('ENOENT')
12+
expect(err.message).to.contain('Error opening file ');
13+
});
14+
});
15+
516
it('should throw an error for an invalid YAML file', function () {
617
return $RefParser
718
.dereference(path.rel('specs/invalid/invalid.yaml'))

0 commit comments

Comments
 (0)