mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 17:43:24 +00:00
Add summary whitespace tests
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
# Summary
|
||||
|
||||
* [Chapter 1](chapter-1/README.md)
|
||||
* [Article 1](chapter-1/ARTICLE1.md)
|
||||
* [Article 2](chapter-1/ARTICLE2.md)
|
||||
* [article 1.2.1](\chapter-1\ARTICLE-1-2-1.md)
|
||||
* [article 1.2.2](/chapter-1/ARTICLE-1-2-2.md)
|
||||
|
||||
* [Chapter 2](chapter-2/README.md)
|
||||
* [Chapter 3](chapter-3/README.md)
|
||||
* [Chapter 4](chapter-4/README.md)
|
||||
|
||||
* Unfinished article
|
||||
|
||||
* Unfinished Chapter
|
||||
+15
-3
@@ -4,10 +4,16 @@ var assert = require('assert');
|
||||
|
||||
var summary = require('../').parse.summary;
|
||||
|
||||
function lex(fixtureFile) {
|
||||
return summary(
|
||||
fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', fixtureFile),
|
||||
'utf8'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/SUMMARY.md'), 'utf8');
|
||||
var LEXED = summary(CONTENT);
|
||||
|
||||
var LEXED = lex('SUMMARY.md');
|
||||
|
||||
describe('Summary parsing', function () {
|
||||
|
||||
@@ -56,4 +62,10 @@ describe('Summary parsing', function () {
|
||||
assert.equal(c[1].articles[1].level, '1.2');
|
||||
assert.equal(c[1].articles[1].articles[0].level, '1.2.1');
|
||||
});
|
||||
|
||||
it('should allow lists separated by whitespace', function() {
|
||||
var l = lex('SUMMARY_WHITESPACE.md');
|
||||
|
||||
assert.equal(l.chapters.length, 6);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user