summaryrefslogtreecommitdiffstats
path: root/test/template.js
blob: 536043d27fcefbf642ebeb460c056b9d71203c5b (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
var mock = require('./mock');
var pkg = require('../package.json');
var Output = require('../lib/output/base');

describe('Template', function() {
    var output;

    before(function() {
        return mock.outputDefaultBook(Output, {
            'test.md': 'World'
        })
        .then(function(_output) {
            output = _output;
        });
    });

    describe('.renderString', function() {
        it('should render a simple string', function() {
            return output.template.renderString('Hello World')
                .should.be.fulfilledWith('Hello World');
        });

        it('should render with variable', function() {
            return output.template.renderString('Version is {{ gitbook.version }}')
                .should.be.fulfilledWith('Version is '+pkg.version);
        });
    });
});