summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-asciidoc/test')
-rwxr-xr-xpackages/gitbook-asciidoc/test/glossary.js5
-rw-r--r--packages/gitbook-asciidoc/test/helper.js6
-rwxr-xr-xpackages/gitbook-asciidoc/test/langs.js5
-rwxr-xr-xpackages/gitbook-asciidoc/test/summary.js5
4 files changed, 21 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/test/glossary.js b/packages/gitbook-asciidoc/test/glossary.js
index eb26f4a..aab73e1 100755
--- a/packages/gitbook-asciidoc/test/glossary.js
+++ b/packages/gitbook-asciidoc/test/glossary.js
@@ -17,4 +17,9 @@ describe('Glossary parsing', function () {
return !Boolean(e.name && e.description);
})));
});
+
+ it('should correctly convert it to text', function() {
+ var text = glossary.toText(LEXED);
+ assertObjectsEqual(glossary(text), LEXED);
+ });
});
diff --git a/packages/gitbook-asciidoc/test/helper.js b/packages/gitbook-asciidoc/test/helper.js
new file mode 100644
index 0000000..1e310f7
--- /dev/null
+++ b/packages/gitbook-asciidoc/test/helper.js
@@ -0,0 +1,6 @@
+var assert = require("assert");
+
+global.assertObjectsEqual = function(o1, o2) {
+ assert.equal(JSON.stringify(o1, null, 4), JSON.stringify(o2, null, 4));
+};
+
diff --git a/packages/gitbook-asciidoc/test/langs.js b/packages/gitbook-asciidoc/test/langs.js
index 9e50965..178c3cc 100755
--- a/packages/gitbook-asciidoc/test/langs.js
+++ b/packages/gitbook-asciidoc/test/langs.js
@@ -15,4 +15,9 @@ describe('Languages parsing', function () {
assert.equal(LEXED[1].path,'fr/');
assert.equal(LEXED[1].title,'French');
});
+
+ it('should correctly convert it to text', function() {
+ var text = langs.toText(LEXED);
+ assertObjectsEqual(langs(text), LEXED);
+ });
});
diff --git a/packages/gitbook-asciidoc/test/summary.js b/packages/gitbook-asciidoc/test/summary.js
index 1c444ce..d363f3f 100755
--- a/packages/gitbook-asciidoc/test/summary.js
+++ b/packages/gitbook-asciidoc/test/summary.js
@@ -37,4 +37,9 @@ describe('Summary parsing', function () {
assert.equal(LEXED.chapters[1].path,'chapter-2/README.adoc');
assert.equal(LEXED.chapters[2].path,'chapter-3/README.adoc');
});
+
+ it('should correctly convert it to text', function() {
+ var text = summary.toText(LEXED);
+ assertObjectsEqual(summary(text), LEXED);
+ });
});