Skip to content

Commit 77aabf4

Browse files
committed
Added mock-fs based test.
1 parent 24d5c5b commit 77aabf4

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"codecov": "1.0.1",
2020
"eslint": "3.8.1",
2121
"istanbul": "0.4.5",
22-
"mocha": "3.1.2"
22+
"mocha": "3.1.2",
23+
"mock-fs": "3.11.0"
2324
},
2425
"scripts": {
2526
"test": "make lint && make coverage"

test/specs/doxdox.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const assert = require('assert');
22
const fs = require('fs');
33

4+
const mock = require('mock-fs');
5+
46
const doxdox = require('../../lib/doxdox');
57

68
describe('doxdox', () => {
@@ -19,6 +21,32 @@ describe('doxdox', () => {
1921

2022
});
2123

24+
describe('parseInput', () => {
25+
26+
before(() => {
27+
28+
mock();
29+
30+
});
31+
32+
it('fails to parse input from invalid file', done => {
33+
34+
doxdox.parseInput('', {'parser': 'dox'}).catch(err => {
35+
36+
done();
37+
38+
});
39+
40+
});
41+
42+
after(() => {
43+
44+
mock.restore();
45+
46+
});
47+
48+
});
49+
2250
describe('parseInputs', () => {
2351

2452
it('parses multiple input from array', done => {

0 commit comments

Comments
 (0)