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/4-langs.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/4-langs.js')
-rw-r--r-- | test/4-langs.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/4-langs.js b/test/4-langs.js new file mode 100644 index 0000000..599cb43 --- /dev/null +++ b/test/4-langs.js @@ -0,0 +1,35 @@ +var mock = require('./mock'); + +describe('Langs', function() { + it('should parse empty langs', function() { + return mock.setupDefaultBook({ + 'LANGS.md': '' + }) + .then(function(book) { + return book.prepareConfig() + + .then(function() { + return book.langs.load(); + }) + + .then(function() { + book.langs.count().should.equal(0); + }); + }); + }); + + it('should parse languages list', function() { + return mock.setupDefaultBook({ + 'LANGS.md': '# Languages\n\n' + + '* [en](./en)\n' + + '* [fr](./fr)\n\n' + }) + .then(function(book) { + return book.langs.load() + .then(function() { + book.langs.count().should.equal(2); + }); + }); + }); +}); + |