summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-markdown/test/readme.js
blob: fad9c53407bdc749c1a66d60159c0fb06ecb07bd (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 expect = require('expect');

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

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

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

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

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

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

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