summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-02-09 17:50:28 +0100
committerSamy Pessé <samypesse@gmail.com>2016-12-22 11:46:18 +0100
commitd59c9e2be10b807b0d3e4bf16cada0e456fa73e7 (patch)
tree43d22ee6bd46badfda5f43ef17b5c58d975d0ca9 /packages/gitbook-asciidoc/test
parent3530e504ba1714b4179719242ade88d8b89e9081 (diff)
downloadgitbook-d59c9e2be10b807b0d3e4bf16cada0e456fa73e7.zip
gitbook-d59c9e2be10b807b0d3e4bf16cada0e456fa73e7.tar.gz
gitbook-d59c9e2be10b807b0d3e4bf16cada0e456fa73e7.tar.bz2
Add tests for toText methods
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);
+ });
});