diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/README.md | 7 | ||||
-rw-r--r-- | test/readme.js | 28 |
2 files changed, 35 insertions, 0 deletions
diff --git a/test/fixtures/README.md b/test/fixtures/README.md new file mode 100644 index 0000000..7e20198 --- /dev/null +++ b/test/fixtures/README.md @@ -0,0 +1,7 @@ +# This is the title + +This is the book description. + +other content +... + diff --git a/test/readme.js b/test/readme.js new file mode 100644 index 0000000..811591c --- /dev/null +++ b/test/readme.js @@ -0,0 +1,28 @@ +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); + +var readme = require('../').parse.readme; + + +var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/README.md'), 'utf8'); +var LEXED = readme(CONTENT); + +describe('Readme parsing', function () { + + it('should contain a title', function() { + assert(LEXED.title); + }); + + it('should contain a description', function() { + assert(LEXED.description); + }); + + it('should extract the right title', function() { + assert.equal(LEXED.title, "This is the title"); + }); + + it('should extract the right description', function() { + assert.equal(LEXED.description, "This is the book description."); + }); +}); |