summaryrefslogtreecommitdiffstats
path: root/test/output-json.js
diff options
context:
space:
mode:
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');
+ });
+ });
+});
+