summaryrefslogtreecommitdiffstats
path: root/test/output-json.js
blob: 1006dab2643e054e3724cb885eff4d96b35651f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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');
        });
    });
});