blob: b38a78d34f7e8eb7d035968bf1869fb36cdcbc2e (
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('assert');
const glossary = require('../src').glossary;
describe('Glossary', () => {
let LEXED;
before(() => {
const CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.md'), '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)))).toBe(true);
});
it('should correctly convert it to text', () => {
const text = glossary.toText(LEXED);
const parsed = glossary(text);
expect(parsed).toEqual(LEXED);
});
});
|