diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-06-16 13:02:38 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-06-16 13:02:38 +0200 |
commit | 3d8b6e550a1ca6ed2c3f3f459c375d6c62432d91 (patch) | |
tree | 9eaf04a5adaaa568dd656b0b2de9f05730283c22 /test/summary.js | |
parent | 3245d7e430ee309961d40c1c03b4c15dac4ec232 (diff) | |
parent | 4c3dbca5ca12c2ea3806a17dc186deff5ce83b79 (diff) | |
download | gitbook-3d8b6e550a1ca6ed2c3f3f459c375d6c62432d91.zip gitbook-3d8b6e550a1ca6ed2c3f3f459c375d6c62432d91.tar.gz gitbook-3d8b6e550a1ca6ed2c3f3f459c375d6c62432d91.tar.bz2 |
Merge pull request #319 from GitbookIO/enchancement/custom_intro
Enchancement/custom intro
Diffstat (limited to 'test/summary.js')
-rw-r--r-- | test/summary.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/test/summary.js b/test/summary.js index 0316b31..2993817 100644 --- a/test/summary.js +++ b/test/summary.js @@ -12,13 +12,13 @@ var LEXED = summary(CONTENT); describe('Summary parsing', function () { it('should detect chapters', function() { - assert.equal(LEXED.chapters.length, 5); + assert.equal(LEXED.chapters.length, 6); }); it('should support articles', function() { - assert.equal(LEXED.chapters[0].articles.length, 2); - assert.equal(LEXED.chapters[1].articles.length, 0); + assert.equal(LEXED.chapters[1].articles.length, 2); assert.equal(LEXED.chapters[2].articles.length, 0); + assert.equal(LEXED.chapters[3].articles.length, 0); }); it('should detect paths and titles', function() { @@ -26,30 +26,34 @@ describe('Summary parsing', function () { assert(LEXED.chapters[1].path); assert(LEXED.chapters[2].path); assert(LEXED.chapters[3].path); - assert.equal(LEXED.chapters[4].path, null); + assert(LEXED.chapters[4].path); + assert.equal(LEXED.chapters[5].path, null); assert(LEXED.chapters[0].title); assert(LEXED.chapters[1].title); assert(LEXED.chapters[2].title); assert(LEXED.chapters[3].title); assert(LEXED.chapters[4].title); + assert(LEXED.chapters[5].title); }); it('should normalize paths from .md to .html', function() { - assert.equal(LEXED.chapters[0].path,'chapter-1/README.md'); - assert.equal(LEXED.chapters[1].path,'chapter-2/README.md'); - assert.equal(LEXED.chapters[2].path,'chapter-3/README.md'); + assert.equal(LEXED.chapters[0].path,'README.md'); + assert.equal(LEXED.chapters[1].path,'chapter-1/README.md'); + assert.equal(LEXED.chapters[2].path,'chapter-2/README.md'); + assert.equal(LEXED.chapters[3].path,'chapter-3/README.md'); }); it('should detect levels correctly', function() { var c = LEXED.chapters; - assert.equal(c[0].level, '1'); - assert.equal(c[1].level, '2'); - assert.equal(c[2].level, '3'); + assert.equal(c[0].level, '0'); + assert.equal(c[1].level, '1'); + assert.equal(c[2].level, '2'); + assert.equal(c[3].level, '3'); - assert.equal(c[0].articles[0].level, '1.1'); - assert.equal(c[0].articles[1].level, '1.2'); - assert.equal(c[0].articles[1].articles[0].level, '1.2.1'); + assert.equal(c[1].articles[0].level, '1.1'); + assert.equal(c[1].articles[1].level, '1.2'); + assert.equal(c[1].articles[1].articles[0].level, '1.2.1'); }); }); |