blob: 65007095f1669ad98f79097e1961d1c2f829bb6e (
plain)
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
|
var mock = require('./mock');
var ConrefsLoader = require('../lib/output/conrefs')();
describe('Conrefs Loader', function() {
var output;
before(function() {
return mock.outputDefaultBook(ConrefsLoader, {
'test.md': 'World'
})
.then(function(_output) {
output = _output;
});
});
it('should include a local file', function() {
return output.template.renderString('Hello {% include "./test.md" %}')
.should.be.fulfilledWith('Hello World');
});
it('should include a git url', function() {
return output.template.renderString('Hello {% include "./test.md" %}')
.should.be.fulfilledWith('Hello World');
});
it('should reject file out of scope', function() {
return output.template.renderString('Hello {% include "../test.md" %}')
.should.be.rejected();
});
describe('Git Urls', function() {
it('should include a file from a git repo', function() {
return output.template.renderString('{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md" %}')
.should.be.fulfilledWith('Hello from git');
});
it('should handle deep inclusion (1)', function() {
return output.template.renderString('{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test2.md" %}')
.should.be.fulfilledWith('First Hello. Hello from git');
});
it('should handle deep inclusion (2)', function() {
return output.template.renderString('{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test3.md" %}')
.should.be.fulfilledWith('First Hello. Hello from git');
});
});
});
|