blob: abef367ec0a11706c21e0673d7b054778011a498 (
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
|
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var glossary = require('../').glossary;
describe('Glossary parsing', function () {
var LEXED;
before(function() {
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.adoc'), 'utf8');
LEXED = glossary(CONTENT);
});
it('should only get heading + paragraph pairs', function() {
assert.equal(LEXED.length, 5);
});
it('should output simple name/description objects', function() {
assert.equal(true, !(LEXED.some(function(e) {
return !Boolean(e.name && e.description);
})));
});
it('should correctly convert it to text', function() {
var text = glossary.toText(LEXED);
assertObjectsEqual(glossary(text), LEXED);
});
});
|