diff options
Diffstat (limited to 'test/langs.js')
-rw-r--r-- | test/langs.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/langs.js b/test/langs.js new file mode 100644 index 0000000..91dbd5a --- /dev/null +++ b/test/langs.js @@ -0,0 +1,46 @@ +var mock = require('./mock'); + +describe('Langs', function() { + it('should parse empty langs', function() { + return mock.setupDefaultBook({ + 'LANGS.md': '' + }) + .then(function(book) { + return book.config.load() + + .then(function() { + return book.langs.load(); + }) + + .then(function() { + book.langs.count().should.equal(0); + }); + }); + }); + + describe('Non-empty languages list', function() { + var book; + + before(function() { + return mock.setupDefaultBook({ + 'LANGS.md': '# Languages\n\n' + + '* [en](./en)\n' + + '* [fr](./fr)\n\n' + }) + .then(function(_book) { + book = _book; + + return book.langs.load(); + }); + }); + + it('should correctly count languages', function() { + book.langs.count().should.equal(2); + }); + + it('should correctly define book as multilingual', function() { + book.isMultilingual().should.equal(true); + }); + }); +}); + |