diff options
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); + }); + }); + +}); |