blob: b55693f627ec527389dae2f95b468fab6922ccb3 (
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
|
var mock = require('./mock');
var TemplateEngine = require('../lib/template');
var pkg = require('../package.json');
describe('Template', function() {
var book, tpl;
before(function() {
return mock.setupDefaultBook()
.then(function(_book) {
book = _book;
return book.parse();
})
.then(function() {
tpl = new TemplateEngine(book);
});
});
describe('.renderString', function() {
it('should render a simple string', function() {
return tpl.renderString('Hello World')
.should.be.fulfilledWith('Hello World');
});
it('should render with variable', function() {
return tpl.renderString('Version is {{ gitbook.version }}')
.should.be.fulfilledWith('Version is '+pkg.version);
});
});
});
|