summaryrefslogtreecommitdiffstats
path: root/test/json.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-22 21:04:36 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-22 21:04:36 +0100
commit877f2e477b010f9f37a9044606f110a90f077680 (patch)
tree5cd61cf3b00ba10dc6110535ed9fdf67d8baba72 /test/json.js
parentc8e2fc0e57d223c01a51d6ee186fc1662cd74d13 (diff)
downloadgitbook-877f2e477b010f9f37a9044606f110a90f077680.zip
gitbook-877f2e477b010f9f37a9044606f110a90f077680.tar.gz
gitbook-877f2e477b010f9f37a9044606f110a90f077680.tar.bz2
Start rewrite
Diffstat (limited to 'test/json.js')
-rw-r--r--test/json.js92
1 files changed, 0 insertions, 92 deletions
diff --git a/test/json.js b/test/json.js
deleted file mode 100644
index 60baf9a..0000000
--- a/test/json.js
+++ /dev/null
@@ -1,92 +0,0 @@
-var fs = require('fs');
-var path = require('path');
-
-describe('JSON generator', function () {
- describe('Basic Book', function() {
- var book;
-
- before(function() {
- return books.generate('basic', 'json')
- .then(function(_book) {
- book = _book;
- });
- });
-
- it('should correctly output a README.json', function() {
- book.should.have.file('README.json');
- });
-
- it('should output a valid json', function() {
- book.should.have.jsonfile('README.json');
- });
-
- describe('Page Format', function() {
- var page;
-
- before(function() {
- page = JSON.parse(
- fs.readFileSync(
- path.join(book.options.output, 'README.json'),
- { encoding: 'utf-8' }
- )
- );
- });
-
- it('should contains valid section', function() {
- page.should.have.property('sections').with.lengthOf(1);
- page.sections[0].should.have.property('content').which.is.a.String();
- page.sections[0].should.have.property('type', 'normal');
- });
-
- it('should contains valid progress', function() {
- page.should.have.property('progress');
- page.progress.should.have.property('chapters').with.lengthOf(1);
- page.progress.should.have.property('current');
- });
-
- it('should contains no languages', function() {
- page.should.have.property('langs').with.lengthOf(0);
- });
- });
- });
-
- describe('Multilingual Book', function() {
- var book;
-
- before(function() {
- return books.generate('languages', 'json')
- .then(function(_book) {
- book = _book;
- });
- });
-
- it('should correctly output READMEs', function() {
- book.should.have.file('README.json');
- book.should.have.file('en/README.json');
- book.should.have.file('fr/README.json');
- });
-
- it('should output valid json', function() {
- book.should.have.jsonfile('README.json');
- book.should.have.jsonfile('en/README.json');
- book.should.have.jsonfile('fr/README.json');
- });
-
- describe('Page Format', function() {
- var page;
-
- before(function() {
- page = JSON.parse(
- fs.readFileSync(
- path.join(book.options.output, 'README.json'),
- { encoding: 'utf-8' }
- )
- );
- });
-
- it('should contains no languages', function() {
- page.should.have.property('langs').with.lengthOf(2);
- });
- });
- });
-});