Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit cfc7602

Browse files
committed
Simplified unit test.
1 parent d15b556 commit cfc7602

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

test/.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": [
33
"@neogeek/eslint-config-standards/.eslintrc-tests"
4-
]
4+
],
5+
"rules": {
6+
"no-sync": 0
7+
}
58
}

test/specs/parser.js

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,23 @@
11
const assert = require('assert');
22
const fs = require('fs');
3-
const path = require('path');
43

54
const parser = require('../../index');
65

76
describe('doxdox parser', () => {
87

98
['dox', 'facade'].forEach(file => {
109

11-
it(`parser on ${file}.js`, done => {
10+
it(`run dox parser on ${file}.js`, () => {
1211

13-
fs.readFile(path.join(__dirname, `../fixtures/${file}.js`), 'utf8', (err, contents) => {
12+
const contents = fs.readFileSync(`./test/fixtures/${file}.js`, 'utf8');
1413

15-
if (err) {
14+
const methods = parser(contents, `${file}.js`);
1615

17-
throw new Error(err);
16+
// fs.writeFileSync(path.join(__dirname, `../fixtures/${file}.json`), JSON.stringify(methods, true, 4));
1817

19-
}
18+
const data = fs.readFileSync(`./test/fixtures/${file}.json`, 'utf8');
2019

21-
const methods = parser(contents, `${file}.js`);
22-
23-
// fs.writeFileSync(path.join(__dirname, `../fixtures/${file}.json`), JSON.stringify(methods, true, 4));
24-
25-
fs.readFile(path.join(__dirname, `../fixtures/${file}.json`), 'utf8', (err, data) => {
26-
27-
if (err) {
28-
29-
throw new Error(err);
30-
31-
}
32-
33-
assert.deepEqual(methods, JSON.parse(data));
34-
35-
done();
36-
37-
});
38-
39-
});
20+
assert.deepEqual(methods, JSON.parse(data));
4021

4122
});
4223

0 commit comments

Comments
 (0)