diff options
author | Soreine <soreine.plume@gmail.com> | 2016-06-06 11:50:06 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 12:32:18 +0100 |
commit | 22b22dea1ca61285d5228f95a4fc008709e38d7d (patch) | |
tree | be3539b3e0ab6db4adbf77df4170800b3e764b92 /packages/gitbook-html/test/summary.js | |
parent | 67424a9091663e19c9ddbd23fc0cc1619c23c843 (diff) | |
download | gitbook-22b22dea1ca61285d5228f95a4fc008709e38d7d.zip gitbook-22b22dea1ca61285d5228f95a4fc008709e38d7d.tar.gz gitbook-22b22dea1ca61285d5228f95a4fc008709e38d7d.tar.bz2 |
Parsing empty parts
Diffstat (limited to 'packages/gitbook-html/test/summary.js')
-rwxr-xr-x | packages/gitbook-html/test/summary.js | 13 |
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() { |