diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-12 11:15:13 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-12 11:15:13 +0200 |
commit | 8aa2f3075c81161746cd63a388ce0eddc536ac15 (patch) | |
tree | a33ac0df67023a69b985b650e3b33af7e12ae117 /lib/parse/__tests__ | |
parent | 839ee0385af2e6a9917826b07dd61c851244e6e0 (diff) | |
download | gitbook-8aa2f3075c81161746cd63a388ce0eddc536ac15.zip gitbook-8aa2f3075c81161746cd63a388ce0eddc536ac15.tar.gz gitbook-8aa2f3075c81161746cd63a388ce0eddc536ac15.tar.bz2 |
Fix #1294: multilingual book should extend the book's config
Diffstat (limited to 'lib/parse/__tests__')
-rw-r--r-- | lib/parse/__tests__/parseBook.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/parse/__tests__/parseBook.js b/lib/parse/__tests__/parseBook.js index 912d32d..b1236c9 100644 --- a/lib/parse/__tests__/parseBook.js +++ b/lib/parse/__tests__/parseBook.js @@ -27,6 +27,41 @@ describe('parseBook', function() { }); }); + it('should extend configuration for multilingual book', function() { + var fs = createMockFS({ + 'LANGS.md': '# Languages\n\n* [en](en)\n* [fr](fr)', + 'book.json': '{ "title": "Test", "author": "GitBook" }', + 'en': { + 'README.md': 'Hello', + 'book.json': '{ "title": "Test EN" }' + }, + 'fr': { + 'README.md': 'Bonjour' + } + }); + var book = Book.createForFS(fs); + + return parseBook(book) + .then(function(resultBook) { + var books = resultBook.getBooks(); + + expect(resultBook.isMultilingual()).toBe(true); + expect(books.size).toBe(2); + + var en = books.get('en'); + var fr = books.get('fr'); + + var enConfig = en.getConfig(); + var frConfig = fr.getConfig(); + + expect(enConfig.getValue('title')).toBe('Test EN'); + expect(enConfig.getValue('author')).toBe('GitBook'); + + expect(frConfig.getValue('title')).toBe('Test'); + expect(frConfig.getValue('author')).toBe('GitBook'); + }); + }); + it('should parse book in a directory', function() { var fs = createMockFS({ 'book.json': JSON.stringify({ |