|
1 | 1 | const assert = require('assert'); |
2 | 2 | const fs = require('fs'); |
3 | | -const path = require('path'); |
4 | 3 |
|
5 | 4 | const parser = require('../../index'); |
6 | 5 |
|
7 | 6 | describe('doxdox parser', () => { |
8 | 7 |
|
9 | 8 | ['dox', 'facade'].forEach(file => { |
10 | 9 |
|
11 | | - it(`parser on ${file}.js`, done => { |
| 10 | + it(`run dox parser on ${file}.js`, () => { |
12 | 11 |
|
13 | | - fs.readFile(path.join(__dirname, `../fixtures/${file}.js`), 'utf8', (err, contents) => { |
| 12 | + const contents = fs.readFileSync(`./test/fixtures/${file}.js`, 'utf8'); |
14 | 13 |
|
15 | | - if (err) { |
| 14 | + const methods = parser(contents, `${file}.js`); |
16 | 15 |
|
17 | | - throw new Error(err); |
| 16 | + // fs.writeFileSync(path.join(__dirname, `../fixtures/${file}.json`), JSON.stringify(methods, true, 4)); |
18 | 17 |
|
19 | | - } |
| 18 | + const data = fs.readFileSync(`./test/fixtures/${file}.json`, 'utf8'); |
20 | 19 |
|
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)); |
40 | 21 |
|
41 | 22 | }); |
42 | 23 |
|
|
0 commit comments