summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/test/glossary.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-asciidoc/test/glossary.js')
-rwxr-xr-xpackages/gitbook-asciidoc/test/glossary.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/test/glossary.js b/packages/gitbook-asciidoc/test/glossary.js
new file mode 100755
index 0000000..eb26f4a
--- /dev/null
+++ b/packages/gitbook-asciidoc/test/glossary.js
@@ -0,0 +1,20 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var glossary = require('../').glossary;
+
+var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.adoc'), 'utf8');
+var LEXED = glossary(CONTENT);
+
+describe('Glossary parsing', function () {
+ 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);
+ })));
+ });
+});