This repository was archived by the owner on Mar 25, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbasic.js
More file actions
45 lines (35 loc) · 1.19 KB
/
basic.js
File metadata and controls
45 lines (35 loc) · 1.19 KB
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
var Lab = require('lab');
var lab = exports.lab = Lab.script();
var assert = require('assert');
var spawn = require('child_process').spawn;
lab.experiment('doc generation', function() {
lab.test('it renders html from *.markdown files', function(done) {
var files = [__dirname + '/fixtures/markdown/index.markdown'];
generate('html', files, function (err, buf) {
assert.ok(/<h2>hello from index.markdown/.test(buf.toString()));
done();
});
});
lab.test('it processes includes from *.markdown files', function(done) {
var files = [__dirname + '/fixtures/markdown/index.markdown'];
generate('html', files, function (err, buf) {
assert.ok(/<h2>Hello from include with markdown-fileending!/.test(buf.toString()));
done();
});
});
});
function generate(format, files, cb) {
var buffer = '',
child;
child = spawn(__dirname + '/../generate.js', [
'--format=' + format,
'--gtoc=' + __dirname + '/fixtures/markdown/_toc.markdown',
'--template=' + __dirname + '/fixtures/template.html'
].concat(files));
child.stdout.on('data', function(chunk) {
buffer += chunk;
});
child.on('close', function () {
cb(null, buffer);
});
}