This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtest.js
57 lines (56 loc) · 2.39 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var test = require('tape'),
dox = require('dox'),
doxme = require('./index.js'),
fs = require('fs');
test('doxme', function(t) {
t.test('bare', function(tt) {
var bare = doxme(dox.parseComments(fs.readFileSync('./index.js', 'utf8')));
if (process.env.UPDATE) { fs.writeFileSync('test/bare.md', bare); }
tt.equal(bare, fs.readFileSync('test/bare.md', 'utf8'));
tt.end();
});
t.test('readme', function(tt) {
var readme = doxme(
dox.parseComments(fs.readFileSync('./index.js', 'utf8')),
true,
require('./package.json'));
if (process.env.UPDATE) { fs.writeFileSync('test/readme.md', readme); }
tt.equal(readme, fs.readFileSync('test/readme.md', 'utf8'));
tt.end();
});
t.test('readme + travis', function(tt) {
var readme = doxme(
dox.parseComments(fs.readFileSync('./index.js', 'utf8')),
true,
require('./package.json'),
true);
if (process.env.UPDATE) { fs.writeFileSync('test/travis.md', readme); }
tt.equal(readme, fs.readFileSync('test/travis.md', 'utf8'));
tt.end();
});
t.test('@return synonym', function(tt) {
var result = doxme(dox.parseComments(fs.readFileSync('./test/return.js', 'utf8')));
if (process.env.UPDATE) { fs.writeFileSync('test/return.md', result); }
tt.equal(result, fs.readFileSync('test/return.md', 'utf8'));
tt.end();
});
t.test('@function tag', function(tt) {
var result = doxme(dox.parseComments(fs.readFileSync('./test/function.js', 'utf8')));
if (process.env.UPDATE) { fs.writeFileSync('test/function.md', result); }
tt.equal(result, fs.readFileSync('test/function.md', 'utf8'));
tt.end();
});
t.test('params', function(tt) {
var result = doxme(dox.parseComments(fs.readFileSync('./test/params.js', 'utf8')));
if (process.env.UPDATE) { fs.writeFileSync('test/params.md', result); }
tt.equal(result, fs.readFileSync('test/params.md', 'utf8'));
tt.end();
});
t.test('private', function(tt) {
var result = doxme(dox.parseComments(fs.readFileSync('./test/private.js', 'utf8')));
if (process.env.UPDATE) { fs.writeFileSync('test/private.md', result); }
tt.equal(result, fs.readFileSync('test/private.md', 'utf8'));
tt.end();
});
t.end();
});