summaryrefslogtreecommitdiffstats
path: root/test/output-website.js
blob: 9fe1928a17d3585118fec06b25879bf1319b0fbe (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
50
51
52
53
54
55
56
57
58
59
60
61
var mock = require('./mock');
var WebsiteOutput = require('../lib/output/website');

describe('Website Output', function() {

    describe('Sample Book', function() {
        var output;

        before(function() {
            return mock.outputDefaultBook(WebsiteOutput)
            .then(function(_output) {
                output = _output;
            });
        });

        it('should correctly generate an index.html', function() {
            output.should.have.file('index.html');
        });

        it('should correctly copy assets', function() {
            output.should.have.file('gitbook/app.js');
            output.should.have.file('gitbook/images/favicon.ico');
        });

    });

    describe('Book with chapters', function() {
        var output;

        before(function() {
            return mock.outputDefaultBook(WebsiteOutput, {
                'hello/README.md': '# Hello',
                'hello/test.md': '# Test'
            }, [
                {
                    title: 'Hello',
                    path: 'hello/README.md'
                },
                {
                    title: 'Test',
                    path: 'hello/test.md'
                }
            ])
            .then(function(_output) {
                output = _output;
            });
        });

        it('should correctly generate an index.html', function() {
            output.should.have.file('index.html');
        });

        it('should correctly generate files in folder', function() {
            output.should.have.file('hello/index.html');
            output.should.have.file('hello/test.html');
        });

    });

});