blob: 23c850af12b6c6da50d7430eec6cc0bf08e8c2d4 (
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
|
const fs = require('fs');
const path = require('path');
const expect = require('expect');
const glossary = require('../src').glossary;
describe('Glossary parsing', () => {
let LEXED;
before(() => {
const CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.adoc'), 'utf8');
LEXED = glossary(CONTENT);
});
it('should only get heading + paragraph pairs', () => {
expect(LEXED.length).toBe(4);
});
it('should output simple name/description objects', () => {
expect(!(LEXED.some(e => !Boolean(e.name && e.description)))).toBeTruthy();
});
it('should correctly convert it to text', () => {
const text = glossary.toText(LEXED);
const parsed = glossary(text);
expect(parsed).toEqual(LEXED);
});
});
|