diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-09-28 00:57:56 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 15:00:48 +0100 |
commit | 7f95f600487eead5085b9a5e2d4d878cc9648e68 (patch) | |
tree | 7bb59c38e420c8ac3f503548fdbafb61dc215e70 /packages/gitbook-markdown/test | |
parent | 065cf8d9c5b116ee7259f94e92c0ada7df35020b (diff) | |
download | gitbook-7f95f600487eead5085b9a5e2d4d878cc9648e68.zip gitbook-7f95f600487eead5085b9a5e2d4d878cc9648e68.tar.gz gitbook-7f95f600487eead5085b9a5e2d4d878cc9648e68.tar.bz2 |
Fix #5: Throw error when entry is invalid (no text)
Diffstat (limited to 'packages/gitbook-markdown/test')
-rw-r--r-- | packages/gitbook-markdown/test/fixtures/SUMMARY_SUBLIST.md | 6 | ||||
-rw-r--r-- | packages/gitbook-markdown/test/summary.js | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/test/fixtures/SUMMARY_SUBLIST.md b/packages/gitbook-markdown/test/fixtures/SUMMARY_SUBLIST.md new file mode 100644 index 0000000..9f21215 --- /dev/null +++ b/packages/gitbook-markdown/test/fixtures/SUMMARY_SUBLIST.md @@ -0,0 +1,6 @@ +# Summary + +* Test +* 1. Landform + + diff --git a/packages/gitbook-markdown/test/summary.js b/packages/gitbook-markdown/test/summary.js index 98cd57f..a1bb49a 100644 --- a/packages/gitbook-markdown/test/summary.js +++ b/packages/gitbook-markdown/test/summary.js @@ -56,6 +56,15 @@ describe('Summary parsing', function () { assert.equal(l.chapters.length, 1); }); + it('should throw error for sublist entries', function() { + assert.throws( + function() { + var l = lex('SUMMARY_SUBLIST.md'); + }, + "Invalid entry in the SUMMARY" + ); + }); + it('should correctly convert it to text', function() { var text = summary.toText(LEXED); assertObjectsEqual(summary(text), LEXED); |