summaryrefslogtreecommitdiffstats
path: root/test/langs.js
blob: dbde992b765d80172961edb1c1be3fa78976650c (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
var mock = require('./mock');

describe('Langs', function() {
    it('should parse empty langs', function() {
        return mock.setupDefaultBook({
            'LANGS.md': ''
        })
        .then(function(book) {
            return book.prepareConfig()

            .then(function() {
                return book.langs.load();
            })

            .then(function() {
                book.langs.count().should.equal(0);
            });
        });
    });

    describe('Non-empty languages list', function() {
        var book;

        before(function() {
            return mock.setupDefaultBook({
                'LANGS.md': '# Languages\n\n'
                    + '* [en](./en)\n'
                    + '* [fr](./fr)\n\n'
            })
            .then(function(_book) {
                book = _book;

                return book.langs.load();
            });
        });

        it('should correctly count languages', function() {
            book.langs.count().should.equal(2);
        });

        it('should correctly define book as multilingual', function() {
            book.isMultilingual().should.equal(true);
        });
    });
});