summaryrefslogtreecommitdiffstats
path: root/test/parse.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-26 09:41:26 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-26 09:41:26 +0100
commitd3d64f636c859f7f01a64f7774cf70bd8ccdc562 (patch)
tree4f7731f37c3a793d187b0ab1cd77680e69534c6c /test/parse.js
parent4cb9cbb5ae3aa8f9211ffa3ac5e3d34232c0ca4f (diff)
parenteef072693b17526347c37b66078a5059c71caa31 (diff)
downloadgitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.zip
gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.gz
gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.bz2
Merge pull request #1109 from GitbookIO/3.0.0
Version 3.0.0
Diffstat (limited to 'test/parse.js')
-rw-r--r--test/parse.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/parse.js b/test/parse.js
new file mode 100644
index 0000000..63565ee
--- /dev/null
+++ b/test/parse.js
@@ -0,0 +1,59 @@
+var mock = require('./mock');
+
+describe('Parsing', function() {
+ it('should not fail without SUMMARY', function() {
+ return mock.setupBook({
+ 'README.md': ''
+ })
+ .then(function(book) {
+ return book.parse().should.be.fulfilled();
+ });
+ });
+
+ it('should fail without README', function() {
+ return mock.setupBook({
+ 'SUMMARY.md': ''
+ })
+ .then(function(book) {
+ return book.parse().should.be.rejected;
+ });
+ });
+
+ it('should add GLOSSARY as a page', function() {
+ return mock.setupDefaultBook({
+ 'GLOSSARY.md': ''
+ })
+ .then(function(book) {
+ return book.parse()
+ .then(function() {
+ book.hasPage('GLOSSARY.md').should.equal(true);
+ });
+ });
+ });
+
+ describe('Multilingual book', function() {
+ var book;
+
+ before(function() {
+ return mock.setupBook({
+ 'LANGS.md': '# Languages\n\n'
+ + '* [English](./en)\n'
+ + '* [French](./fr)\n\n',
+ 'en/README.md': '# English',
+ 'en/SUMMARY.md': '# Summary',
+ 'fr/README.md': '# French',
+ 'fr/SUMMARY.md': '# Summary'
+ })
+ .then(function(_book) {
+ book = _book;
+ return book.parse();
+ });
+ });
+
+ it('should list language books', function() {
+ book.isMultilingual().should.equal(true);
+ book.books.should.have.lengthOf(2);
+ });
+ });
+});
+