Add readme parsing for extracting title and description

This commit is contained in:
Samy Pessé
2014-04-14 19:21:43 +02:00
parent f43e630528
commit c0ca055bf4
4 changed files with 68 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
# This is the title
This is the book description.
other content
...
+28
View File
@@ -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.");
});
});