summaryrefslogtreecommitdiffstats
path: root/test/output-json.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-26 09:41:26 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-26 09:41:26 +0100
commitd3d64f636c859f7f01a64f7774cf70bd8ccdc562 (patch)
tree4f7731f37c3a793d187b0ab1cd77680e69534c6c /test/output-json.js
parent4cb9cbb5ae3aa8f9211ffa3ac5e3d34232c0ca4f (diff)
parenteef072693b17526347c37b66078a5059c71caa31 (diff)
downloadgitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.zip
gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.gz
gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.bz2
Merge pull request #1109 from GitbookIO/3.0.0
Version 3.0.0
Diffstat (limited to 'test/output-json.js')
-rw-r--r--test/output-json.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/output-json.js b/test/output-json.js
new file mode 100644
index 0000000..1006dab
--- /dev/null
+++ b/test/output-json.js
@@ -0,0 +1,49 @@
+var mock = require('./mock');
+var JSONOutput = require('../lib/output/json');
+
+describe('JSON Output', function() {
+
+ describe('Sample book', function() {
+ var output;
+
+ before(function() {
+ return mock.outputDefaultBook(JSONOutput)
+ .then(function(_output) {
+ output = _output;
+ });
+ });
+
+ it('should correctly generate a README.json', function() {
+ output.should.have.file('README.json');
+ });
+
+ });
+
+ describe('Multilingual Book', function() {
+ var output;
+
+ before(function() {
+ return mock.outputBook(JSONOutput, {
+ 'LANGS.md': '# Languages\n\n'
+ + '* [en](./en)\n'
+ + '* [fr](./fr)\n\n',
+ 'en/README.md': '# Hello',
+ 'fr/README.md': '# Bonjour'
+
+ })
+ .then(function(_output) {
+ output = _output;
+ });
+ });
+
+ it('should correctly generate a README.json for each language', function() {
+ output.should.have.file('en/README.json');
+ output.should.have.file('fr/README.json');
+ });
+
+ it('should correctly generate a README.json for the whole book', function() {
+ output.should.have.file('README.json');
+ });
+ });
+});
+