diff options
Diffstat (limited to 'test/output-website.js')
-rw-r--r-- | test/output-website.js | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/test/output-website.js b/test/output-website.js new file mode 100644 index 0000000..19459b3 --- /dev/null +++ b/test/output-website.js @@ -0,0 +1,99 @@ +var mock = require('./mock'); +var WebsiteOutput = require('../lib/output/website'); + +describe('Website Output', function() { + + describe('Sample Book', function() { + var output; + + before(function() { + return mock.outputDefaultBook(WebsiteOutput) + .then(function(_output) { + output = _output; + }); + }); + + it('should correctly generate an index.html', function() { + output.should.have.file('index.html'); + }); + + it('should correctly copy assets', function() { + output.should.have.file('gitbook/app.js'); + output.should.have.file('gitbook/images/favicon.ico'); + }); + + it('should correctly copy plugins', function() { + output.should.have.file('gitbook/gitbook-plugin-highlight/website.css'); + }); + }); + + describe('Book with chapters', function() { + var output; + + before(function() { + return mock.outputDefaultBook(WebsiteOutput, { + 'hello/README.md': '# Hello', + 'hello/test.md': '# Test' + }, [ + { + title: 'Hello', + path: 'hello/README.md' + }, + { + title: 'Test', + path: 'hello/test.md' + } + ]) + .then(function(_output) { + output = _output; + }); + }); + + it('should correctly generate an index.html', function() { + output.should.have.file('index.html'); + }); + + it('should correctly generate files in folder', function() { + output.should.have.file('hello/index.html'); + output.should.have.file('hello/test.html'); + }); + }); + + describe('Multilingual Book', function() { + var output; + + before(function() { + return mock.outputBook(WebsiteOutput, { + 'LANGS.md': '# Languages\n\n' + + '* [en](./en)\n' + + '* [fr](./fr)\n\n', + 'en/README.md': '# Hello', + 'fr/README.md': '# Bonjour' + + }) + .then(function(_output) { + output = _output; + }); + }); + + it('should correctly generate an index.html for each language', function() { + output.should.have.file('en/index.html'); + output.should.have.file('fr/index.html'); + }); + + it('should correctly copy assets', function() { + output.should.have.file('gitbook/app.js'); + }); + + it('should not copy assets for each language', function() { + output.should.have.not.file('en/gitbook/app.js'); + output.should.have.not.file('fr/gitbook/app.js'); + }); + + it('should correctly generate an index.html', function() { + output.should.have.file('index.html'); + }); + }); + +}); + |