diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-01-31 17:01:50 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-01-31 17:01:50 +0100 |
commit | a24aa79dbf5be625ec3fdac50aca955c0b478fec (patch) | |
tree | c2f9c15ae7c703d8bb1e100198108369bafb7174 /test/template.js | |
parent | 633de85180b1c968edc3e884821c3de668d23506 (diff) | |
download | gitbook-a24aa79dbf5be625ec3fdac50aca955c0b478fec.zip gitbook-a24aa79dbf5be625ec3fdac50aca955c0b478fec.tar.gz gitbook-a24aa79dbf5be625ec3fdac50aca955c0b478fec.tar.bz2 |
Add base for templating
Diffstat (limited to 'test/template.js')
-rw-r--r-- | test/template.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/template.js b/test/template.js new file mode 100644 index 0000000..b55693f --- /dev/null +++ b/test/template.js @@ -0,0 +1,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); + }); + }); + +}); |