diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-19 22:39:23 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-19 22:39:23 +0100 |
commit | c15399613cf3e589eb106d37221fae9c54002d74 (patch) | |
tree | 0ae3f7140eccbbbe0a3b156400179acec29a8e0e /test | |
parent | d6f7f1f4fb12ac1c24624aa8358f8149ec720622 (diff) | |
download | gitbook-c15399613cf3e589eb106d37221fae9c54002d74.zip gitbook-c15399613cf3e589eb106d37221fae9c54002d74.tar.gz gitbook-c15399613cf3e589eb106d37221fae9c54002d74.tar.bz2 |
Normalize paths in html content
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/test1/SUMMARY.md | 2 | ||||
-rw-r--r-- | test/fixtures/test1/sub/test1.md | 6 | ||||
-rw-r--r-- | test/generation.js | 6 | ||||
-rw-r--r-- | test/parsing.js | 5 |
4 files changed, 14 insertions, 5 deletions
diff --git a/test/fixtures/test1/SUMMARY.md b/test/fixtures/test1/SUMMARY.md index 4adaf3e..4a87f8c 100644 --- a/test/fixtures/test1/SUMMARY.md +++ b/test/fixtures/test1/SUMMARY.md @@ -1,6 +1,6 @@ # Summary * [Chapter 1](test.md) - * [Article 1](test1.md) + * [Article 1](sub/test1.md) * [Chapter 2](test2.md) diff --git a/test/fixtures/test1/sub/test1.md b/test/fixtures/test1/sub/test1.md new file mode 100644 index 0000000..6a6e788 --- /dev/null +++ b/test/fixtures/test1/sub/test1.md @@ -0,0 +1,6 @@ +# This file is used to etst links transformations: + +This is a relative link [test](../intro.md). + + + diff --git a/test/generation.js b/test/generation.js index b043885..d339837 100644 --- a/test/generation.js +++ b/test/generation.js @@ -24,7 +24,11 @@ describe('Book generation', function () { it('should correctly generate a book to json', function(done) { testGeneration(book1, "json", function(output) { assert(!fs.existsSync(path.join(output, "README.json"))); - assert(fs.existsSync(path.join(output, "intro.json"))) + assert(fs.existsSync(path.join(output, "intro.json"))); + assert(fs.existsSync(path.join(output, "sub/test1.json"))); + + var test1 = JSON.parse(fs.readFileSync(path.join(output, "sub/test1.json"))); + assert(test1.sections[0].content.indexOf("intro.html") > 0); }, done); }); diff --git a/test/parsing.js b/test/parsing.js index 477631f..4e76d2c 100644 --- a/test/parsing.js +++ b/test/parsing.js @@ -31,8 +31,7 @@ describe('Book parsing', function () { it('should correctly parse list of files', function() { var FILES = book1.files; - assert.equal(FILES.length, 2); - assert.equal(_.difference(FILES, [ 'intro.md', 'README.md' ]).length, 0); + assert.deepEqual(FILES, [ 'README.md', 'intro.md', 'sub/', 'sub/test1.md' ]); }); it('should correctly parse the languages', function() { @@ -49,7 +48,7 @@ describe('Book parsing', function () { it('should correctly parse the navigation', function() { var NAVIGATION = book1.navigation; - assert.equal(_.size(NAVIGATION), 1); + assert.equal(_.size(NAVIGATION), 2); assert(NAVIGATION["intro.md"]) assert.equal(NAVIGATION["intro.md"].title, "Introduction"); assert.equal(NAVIGATION["intro.md"].prev, null); |