diff options
Diffstat (limited to 'test/config.js')
-rw-r--r-- | test/config.js | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/test/config.js b/test/config.js index 7a96a5c..be28fc9 100644 --- a/test/config.js +++ b/test/config.js @@ -46,7 +46,7 @@ describe('Configuration', function() { return mock.setupDefaultBook() .then(function(_book) { book = _book; - return book.prepareConfig(); + return book.config.load(); }); }); @@ -64,7 +64,7 @@ describe('Configuration', function() { }) .then(function(_book) { book = _book; - return book.prepareConfig(); + return book.config.load(); }); }); @@ -82,7 +82,7 @@ describe('Configuration', function() { }) .then(function(_book) { book = _book; - return book.prepareConfig(); + return book.config.load(); }); }); @@ -90,5 +90,48 @@ describe('Configuration', function() { book.config.get('title', '').should.equal('Hello World'); }); }); + + describe('Multilingual', function() { + var book; + + before(function() { + return mock.setupDefaultBook({ + 'book.json': { + title: 'Hello World', + pluginsConfig: { + 'test': { + 'hello': true + } + } + }, + 'LANGS.md': '# Languages\n\n' + + '* [en](./en)\n' + + '* [fr](./fr)\n\n', + 'en/README.md': '# Hello', + 'fr/README.md': '# Bonjour', + 'en/book.json': { description: 'In english' }, + 'fr/book.json': { description: 'En francais' } + }) + .then(function(_book) { + book = _book; + return book.parse(); + }); + }); + + it('should correctly extend configuration', function() { + book.config.get('title', '').should.equal('Hello World'); + book.config.get('description', '').should.equal(''); + + var en = book.books[0]; + en.config.get('title', '').should.equal('Hello World'); + en.config.get('description', '').should.equal('In english'); + en.config.get('pluginsConfig.test.hello').should.equal(true); + + var fr = book.books[1]; + fr.config.get('title', '').should.equal('Hello World'); + fr.config.get('description', '').should.equal('En francais'); + fr.config.get('pluginsConfig.test.hello').should.equal(true); + }); + }); }); |