Skip to content

Commit 7d0ceae

Browse files
committed
Returned promises in mocha tests.
1 parent 9275a15 commit 7d0ceae

File tree

2 files changed

+33
-64
lines changed

2 files changed

+33
-64
lines changed

test/specs/doxdox.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,29 @@ describe('doxdox', () => {
99

1010
describe('parseInput', () => {
1111

12-
it('parses input from file', done => {
13-
14-
doxdox.parseInput('./lib/doxdox.js', {'parser': 'dox'}).then(() => {
15-
16-
done();
17-
18-
});
19-
20-
});
12+
it('parses input from file', () =>
13+
doxdox.parseInput('./lib/doxdox.js', {'parser': 'dox'}));
2114

2215
});
2316

24-
describe('parseInput', () => {
17+
describe('parseInput (with mock-fs)', () => {
2518

2619
before(() => {
2720

2821
mock();
2922

3023
});
3124

32-
it('fails to parse input from invalid file', done => {
33-
25+
it('fails to parse input from invalid file', () =>
3426
doxdox.parseInput('', {'parser': 'dox'}).catch(err => {
3527

36-
done();
28+
if (err) {
3729

38-
});
30+
console.log(err);
3931

40-
});
32+
}
33+
34+
}));
4135

4236
after(() => {
4337

@@ -49,8 +43,7 @@ describe('doxdox', () => {
4943

5044
describe('parseInputs', () => {
5145

52-
it('parses multiple input from array', done => {
53-
46+
it('parses multiple input from array', () =>
5447
doxdox.parseInputs(['./lib/doxdox.js'], {
5548
'description': '',
5649
'layout': 'markdown',
@@ -60,11 +53,7 @@ describe('doxdox', () => {
6053

6154
assert.equal(content, fs.readFileSync('./test/fixtures/doxdox.md', 'utf8'));
6255

63-
done();
64-
65-
});
66-
67-
});
56+
}));
6857

6958
});
7059

test/specs/loaders.js

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,49 @@ describe('loaders', () => {
44

55
describe('loadParser', () => {
66

7-
it('loads dox parser', done => {
7+
it('loads dox parser', () => loaders.loadParser({'parser': 'dox'}));
88

9-
loaders.loadParser({'parser': 'dox'}).then(() => {
9+
it('fails on invalid parser', () =>
10+
loaders.loadParser({'parser': 'invalid'}).catch(err => {
1011

11-
done();
12+
if (err) {
1213

13-
});
14+
console.log(err);
1415

15-
});
16+
}
1617

17-
it('fails on invalid parser', done => {
18-
19-
loaders.loadParser({'parser': 'invalid'}).catch(() => {
20-
21-
done();
22-
23-
});
24-
25-
});
18+
}));
2619

2720
});
2821

2922
describe('loadPlugin', () => {
3023

31-
it('loads markdown plugin', done => {
32-
33-
loaders.loadPlugin({'layout': 'markdown'}).then(() => {
34-
35-
done();
36-
37-
});
38-
39-
});
40-
41-
it('loads custom handlebars plugin when file is specified', done => {
42-
43-
loaders.loadPlugin({'layout': './test/fixtures/template.hbs'}).then(() => {
44-
45-
done();
46-
47-
});
24+
it('loads markdown plugin', () => loaders.loadPlugin({'layout': 'markdown'}));
4825

49-
});
26+
it('loads custom handlebars plugin when file is specified', () =>
27+
loaders.loadPlugin({'layout': './test/fixtures/template.hbs'}));
5028

51-
it('fails on invalid plugin', done => {
29+
it('fails on invalid plugin', () =>
30+
loaders.loadPlugin({'layout': 'invalid'}).catch(err => {
5231

53-
loaders.loadPlugin({'layout': 'invalid'}).catch(() => {
32+
if (err) {
5433

55-
done();
34+
console.log(err);
5635

57-
});
36+
}
5837

59-
});
38+
}));
6039

61-
it('fails on invalid custom template', done => {
40+
it('fails on invalid custom template', () =>
41+
loaders.loadPlugin({'layout': './test/fixtures/template.html'}).catch(err => {
6242

63-
loaders.loadPlugin({'layout': './test/fixtures/template.html'}).catch(() => {
43+
if (err) {
6444

65-
done();
45+
console.log(err);
6646

67-
});
47+
}
6848

69-
});
49+
}));
7050

7151
});
7252

0 commit comments

Comments
 (0)