summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-28 23:19:39 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-28 23:19:39 +0100
commitea98444dc0a6e59e79408963e1d340d7765ba9f6 (patch)
treeee946c4eebbe2a7cb9c8b572f2921dee859bbc8e /test
parent328c3a7d5141abdeab1488d6de8a47e62ebf48dc (diff)
downloadgitbook-ea98444dc0a6e59e79408963e1d340d7765ba9f6.zip
gitbook-ea98444dc0a6e59e79408963e1d340d7765ba9f6.tar.gz
gitbook-ea98444dc0a6e59e79408963e1d340d7765ba9f6.tar.bz2
Add parsing of summary and tests
Diffstat (limited to 'test')
-rw-r--r--test/3-glossary.js2
-rw-r--r--test/5-summary.js40
-rw-r--r--test/6-parse.js3
3 files changed, 43 insertions, 2 deletions
diff --git a/test/3-glossary.js b/test/3-glossary.js
index 176298f..0efef34 100644
--- a/test/3-glossary.js
+++ b/test/3-glossary.js
@@ -61,7 +61,7 @@ describe('Glossary', function() {
entry.id.should.equal('hello_world');
});
- it('should undefined return non existing entry', function() {
+ it('should return undefined for non existing entry', function() {
var entry = book.glossary.find('Hello');
should.not.exist(entry);
});
diff --git a/test/5-summary.js b/test/5-summary.js
new file mode 100644
index 0000000..2744c43
--- /dev/null
+++ b/test/5-summary.js
@@ -0,0 +1,40 @@
+var mock = require('./mock');
+
+describe('Summary / Table of contents', function() {
+ describe('Empty summary list', function() {
+ var book;
+
+ before(function() {
+ return mock.setupDefaultBook({})
+ .then(function(_book) {
+ book = _book;
+ return book.summary.load();
+ });
+ });
+
+ it('should correctly count articles', function() {
+ book.summary.count().should.equal(1);
+ });
+ });
+
+ describe('Non-empty summary list', function() {
+ var book;
+
+ before(function() {
+ return mock.setupDefaultBook({
+ 'SUMMARY.md': '# Summary\n\n'
+ + '* [Hello](./hello.md)\n'
+ + '* [World](./world.md)\n\n'
+ })
+ .then(function(_book) {
+ book = _book;
+ return book.summary.load();
+ });
+ });
+
+ it('should correctly count articles', function() {
+ book.summary.count().should.equal(3);
+ });
+ });
+});
+
diff --git a/test/6-parse.js b/test/6-parse.js
index a575720..72e0260 100644
--- a/test/6-parse.js
+++ b/test/6-parse.js
@@ -40,7 +40,8 @@ describe('Parsing', function() {
});
it('should list language books', function() {
-
+ book.isMultilingual().should.equal(true);
+ book.books.should.have.lengthOf(2);
});
});
});