summaryrefslogtreecommitdiffstats
path: root/test/5-summary.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/5-summary.js')
-rw-r--r--test/5-summary.js40
1 files changed, 40 insertions, 0 deletions
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);
+ });
+ });
+});
+