diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-01-28 17:35:32 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-01-28 17:35:32 +0100 |
commit | 461ef2c68e9086bd77f0a25d57956ebf60308f7c (patch) | |
tree | c0e8814e3c57ea5bf21526acc3a7e9b1c925576a /test/1-config.js | |
parent | 46efdacd6d3d5c7560d8f956e2339c36157f7c89 (diff) | |
download | gitbook-461ef2c68e9086bd77f0a25d57956ebf60308f7c.zip gitbook-461ef2c68e9086bd77f0a25d57956ebf60308f7c.tar.gz gitbook-461ef2c68e9086bd77f0a25d57956ebf60308f7c.tar.bz2 |
Add unit tests for langs
Diffstat (limited to 'test/1-config.js')
-rw-r--r-- | test/1-config.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/1-config.js b/test/1-config.js new file mode 100644 index 0000000..474ffea --- /dev/null +++ b/test/1-config.js @@ -0,0 +1,39 @@ +var mock = require('./mock'); + +describe('Config', function() { + + describe('config.load()', function() { + it('should not fail if no configuration file', function() { + return mock.setupDefaultBook() + .then(function(book) { + return book.prepareConfig(); + }); + }); + + it('should load from a JSON file', function() { + return mock.setupDefaultBook({ + 'book.json': { title: 'Hello World' } + }) + .then(function(book) { + return book.prepareConfig() + .then(function() { + book.config.get('title', '').should.equal('Hello World'); + }); + }); + }); + + it('should load from a JS file', function() { + return mock.setupDefaultBook({ + 'book.js': 'module.exports = { title: "Hello World" };' + }) + .then(function(book) { + return book.prepareConfig() + .then(function() { + book.config.get('title', '').should.equal('Hello World'); + }); + }); + }); + }); + +}); + |