summaryrefslogtreecommitdiffstats
path: root/test/conrefs.js
blob: 32e40584c925fb2cc28fea1638e69428201c5b28 (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
62
63
64
65
66
67
68
var fs = require('fs');
var path = require('path');

describe('ConRefs', function () {
    var book, readme;

    before(function() {
        return books.generate('conrefs', 'website')
            .then(function(_book) {
                book = _book;

                readme = fs.readFileSync(
                    path.join(book.options.output, 'index.html'),
                    { encoding: 'utf-8' }
                );
            });
    });

    it('should handle local references', function() {
        readme.should.be.html({
            '.page-inner p#t1': {
                count: 1,
                text: 'Hello World',
                trim: true
            }
        });
    });

    it('should handle local references with absolute paths', function() {
        readme.should.be.html({
            '.page-inner p#t2': {
                count: 1,
                text: 'Hello World',
                trim: true
            }
        });
    });

    it('should correctly include file from git reference', function() {
        readme.should.be.html({
            '.page-inner p#t3': {
                count: 1,
                text: 'Hello from git',
                trim: true
            }
        });
    });

    it('should correctly handle deep include in git reference', function() {
        readme.should.be.html({
            '.page-inner p#t4': {
                count: 1,
                text: 'First Hello. Hello from git',
                trim: true
            }
        });
    });

    it('should correctly handle absolute include in git reference', function() {
        readme.should.be.html({
            '.page-inner p#t5': {
                count: 1,
                text: 'First Hello. Hello from git',
                trim: true
            }
        });
    });
});