diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-23 23:18:15 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-23 23:18:15 +0100 |
commit | 2d1aa15af8ee73f7179e323493ab4f6c40f6ac57 (patch) | |
tree | a71b44c602077c411b77cad554b0b47840294cfd /test/json.js | |
parent | 63ee94ff89d10e56d82079183c494f8129b92eae (diff) | |
download | gitbook-2d1aa15af8ee73f7179e323493ab4f6c40f6ac57.zip gitbook-2d1aa15af8ee73f7179e323493ab4f6c40f6ac57.tar.gz gitbook-2d1aa15af8ee73f7179e323493ab4f6c40f6ac57.tar.bz2 |
New cleaner helper for testing
Diffstat (limited to 'test/json.js')
-rw-r--r-- | test/json.js | 59 |
1 files changed, 4 insertions, 55 deletions
diff --git a/test/json.js b/test/json.js index d7f6aac..82966a9 100644 --- a/test/json.js +++ b/test/json.js @@ -1,59 +1,8 @@ -var path = require('path'); -var _ = require('lodash'); -var assert = require('assert'); - -var fs = require("fs"); describe('JSON generator', function () { - it('should correctly generate a book to json with glossary', function(done) { - testGeneration(books[0], "json", function(output) { - assert(fs.existsSync(path.join(output, "README.json"))); - - var readme = JSON.parse(fs.readFileSync(path.join(output, "README.json"))); - assert(readme.sections[0].content.indexOf('class="glossary-term"') > 0); - }, done); - }); - - it('should correctly generate a book to json with sub folders', function(done) { - testGeneration(books[1], "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, "sub/test1.json"))); - - var test1 = JSON.parse(fs.readFileSync(path.join(output, "sub/test1.json"))); - assert(test1.sections[0].content.indexOf("index.html") > 0); - }, done); - }); - - it('should correctly generate a multilingual book to json', function(done) { - testGeneration(books[2], "json", function(output) { - assert(fs.existsSync(path.join(output, "README.json"))); - assert(fs.existsSync(path.join(output, "en/README.json"))); - assert(fs.existsSync(path.join(output, "fr/README.json"))); - }, done); - }); - - it('should correctly generate an asciidoc book to json', function(done) { - testGeneration(books[3], "json", function(output) { - assert(fs.existsSync(path.join(output, "README.json"))); - assert(fs.existsSync(path.join(output, "test.json"))); - assert(fs.existsSync(path.join(output, "test1.json"))); - assert(fs.existsSync(path.join(output, "test2.json"))); - }, done); - }); - - it('should correctly generate a book with local inclusion', function(done) { - testGeneration(books[5], "json", function(output) { - var readme = JSON.parse(fs.readFileSync(path.join(output, "README.json"))); - assert(readme.sections[0].content.indexOf('Hello World') > 0); - }, done); - }); - - it('should correctly generate a book with external inclusion', function(done) { - testGeneration(books[5], "json", function(output) { - var readme = JSON.parse(fs.readFileSync(path.join(output, "README.json"))); - assert(readme.sections[0].content.indexOf('Git1:Hello from git') > 0); - assert(readme.sections[0].content.indexOf('Git2:First Hello. Hello from git') > 0); - }, done); + it('should correctly generate a basic book to json', function() { + return books.generate("basic", "json") + .then(function(book) { + }); }); }); |