summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/test/readme.js
blob: e6a8009d88a6f907cc5945a8bc31e359b9d056c0 (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
const fs = require('fs');
const path = require('path');
const assert = require('assert');

const readme = require('../src').readme;

describe('Readme parsing', () => {
    let LEXED;

    before(() => {
        const CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/README.adoc'), 'utf8');
        LEXED = readme(CONTENT);
    });

    it('should contain a title', () => {
        assert(LEXED.title);
    });

    it('should contain a description', () => {
        assert(LEXED.description);
    });

    it('should extract the right title', () => {
        assert.equal(LEXED.title, 'This is the title');
    });

    it('should extract the right description', () => {
        assert.equal(LEXED.description, 'This is the book description.');
    });
});