summaryrefslogtreecommitdiffstats
path: root/test/4-langs.js
blob: 599cb43640bbbedf58dad256fedcaa86203ca66a (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
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);
            });
        });
    });

    it('should parse languages list', function() {
        return mock.setupDefaultBook({
            'LANGS.md': '# Languages\n\n'
                + '* [en](./en)\n'
                + '* [fr](./fr)\n\n'
        })
        .then(function(book) {
            return book.langs.load()
            .then(function() {
                book.langs.count().should.equal(2);
            });
        });
    });
});