summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-html/test/summary.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-html/test/summary.js')
-rwxr-xr-xpackages/gitbook-html/test/summary.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/gitbook-html/test/summary.js b/packages/gitbook-html/test/summary.js
index 24d22c0..9c064f9 100755
--- a/packages/gitbook-html/test/summary.js
+++ b/packages/gitbook-html/test/summary.js
@@ -8,9 +8,11 @@ describe('Summary parsing', function () {
var LEXED, PART;
before(function() {
- var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/SUMMARY.html'), 'utf8');
+ var CONTENT = fs.readFileSync(
+ path.join(__dirname, './fixtures/SUMMARY.html'), 'utf8');
LEXED = summary(CONTENT);
PART = LEXED.parts[0];
+
});
describe('Parts', function() {
@@ -23,6 +25,15 @@ describe('Summary parsing', function () {
assert.equal(LEXED.parts[1].title, 'Part 2');
assert.equal(LEXED.parts[2].title, '');
});
+
+ it('should detect empty parts', function() {
+ var CONTENT_EMPTY = fs.readFileSync(
+ path.join(__dirname, './fixtures/SUMMARY-EMPTY.html'), 'utf8');
+ var LEXED_EMPTY = summary(CONTENT_EMPTY);
+
+ assert.equal(LEXED_EMPTY.parts.length, 4);
+ assert.equal(LEXED_EMPTY.parts[2].title, 'Empty part');
+ });
});
it('should detect chapters', function() {