diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-08-15 12:12:20 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-08-15 12:12:20 -0700 |
commit | d337a500dc9db1c9ac4cd95938dd10cd06e6a991 (patch) | |
tree | 4216de060a781b4170c30f26483894f82b613ef9 /test | |
parent | 402e88f8663efaa48d619a7831daef0db0398f82 (diff) | |
parent | cbe4e9edec3a1751030ad40a28e25df20fde2b08 (diff) | |
download | gitbook-d337a500dc9db1c9ac4cd95938dd10cd06e6a991.zip gitbook-d337a500dc9db1c9ac4cd95938dd10cd06e6a991.tar.gz gitbook-d337a500dc9db1c9ac4cd95938dd10cd06e6a991.tar.bz2 |
Merge pull request #408 from GitbookIO/feature-glossary
Feature glossary
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/GLOSSARY.md | 30 | ||||
-rw-r--r-- | test/glossary.js | 20 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/fixtures/GLOSSARY.md b/test/fixtures/GLOSSARY.md new file mode 100644 index 0000000..5969902 --- /dev/null +++ b/test/fixtures/GLOSSARY.md @@ -0,0 +1,30 @@ +# Magic +Sufficiently advanced technology, beyond the understanding of the observer producing a sense of wonder. + +Hello, I am random noise in the middle of this beautiful Glossary. (Really astonishing !) + +# PHP +An atrocious language, invented for the sole purpose of inflicting pain and suffering amongst the proframming wizards of this world. + +# Clojure +Lisp re-invented for hipsters. + +# Go +Go Go Google [Wow](https://www.google.com) + +Fantastic, I love code too ! : + +```py + +def f(x): + return x * 4 + +# Wow this is some really awesome code +# totally mind blowing +# but we don't care, it shouldn't be in our glossary ! +print(f(9)) +``` + +# Gitbook + +Awesome project. Really amazing, I'm really at a loss for words ... diff --git a/test/glossary.js b/test/glossary.js new file mode 100644 index 0000000..bf40e16 --- /dev/null +++ b/test/glossary.js @@ -0,0 +1,20 @@ +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); + +var glossary = require('../').parse.glossary; + +var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.md'), '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); + }))); + }); +}); |