summaryrefslogtreecommitdiffstats
path: root/test/parse.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-28 23:23:56 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-28 23:23:56 +0100
commitff30ba62ba694658d1575b0cf3a0fbf3d5e00d62 (patch)
tree31ca85c3d2d93935eb6c351bd9e5ca317fc0e2a3 /test/parse.js
parentea98444dc0a6e59e79408963e1d340d7765ba9f6 (diff)
downloadgitbook-ff30ba62ba694658d1575b0cf3a0fbf3d5e00d62.zip
gitbook-ff30ba62ba694658d1575b0cf3a0fbf3d5e00d62.tar.gz
gitbook-ff30ba62ba694658d1575b0cf3a0fbf3d5e00d62.tar.bz2
Add order for tests
Diffstat (limited to 'test/parse.js')
-rw-r--r--test/parse.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/parse.js b/test/parse.js
new file mode 100644
index 0000000..72e0260
--- /dev/null
+++ b/test/parse.js
@@ -0,0 +1,48 @@
+var mock = require('./mock');
+
+describe('Parsing', function() {
+ it('should fail without SUMMARY', function() {
+ return mock.setupBook({
+ 'README.md': ''
+ })
+ .then(function(book) {
+ return book.parse().should.be.rejected;
+ });
+ });
+
+ it('should fail without README', function() {
+ return mock.setupBook({
+ 'SUMMARY.md': ''
+ })
+ .then(function(book) {
+ return book.parse().should.be.rejected;
+ });
+ });
+
+
+ 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);
+ });
+ });
+});
+