summaryrefslogtreecommitdiffstats
path: root/lib/templating/__tests__/conrefsLoader.js
blob: ff484b70c79580e2517326fc054bd5c5f78a290c (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
var TemplateEngine = require('../../models/templateEngine');
var renderTemplate = require('../render');

describe('ConrefsLoader', function() {
    var ConrefsLoader = require('../conrefsLoader');

    var engine = TemplateEngine({
        loader: new ConrefsLoader(__dirname)
    });

    describe('Git', function() {
        pit('should include content from git', function() {
            return renderTemplate(engine, 'test.md', '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md" %}')
            .then(function(out) {
                expect(out.getContent()).toBe('Hello from git');
            });
        });

        pit('should handle deep inclusion (1)', function() {
            return renderTemplate(engine, 'test.md', '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test2.md" %}')
            .then(function(out) {
                expect(out.getContent()).toBe('First Hello. Hello from git');
            });
        });

        pit('should handle deep inclusion (2)', function() {
            return renderTemplate(engine, 'test.md', '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test3.md" %}')
            .then(function(out) {
                expect(out.getContent()).toBe('First Hello. Hello from git');
            });
        });
    });
});