summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-02 16:40:15 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-02 16:40:51 -0700
commit4bdcfd07a97de370aead0cbb8a9707568c9e4138 (patch)
treea10ade9598f8aaca139a2e685924388074ec2c9a
parenta9967df6eb5b1efbc51a4b03b96f13e62ccabcd7 (diff)
downloadgitbook-4bdcfd07a97de370aead0cbb8a9707568c9e4138.zip
gitbook-4bdcfd07a97de370aead0cbb8a9707568c9e4138.tar.gz
gitbook-4bdcfd07a97de370aead0cbb8a9707568c9e4138.tar.bz2
Add tests for section merging
-rw-r--r--test/page.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/page.js b/test/page.js
index 082cda6..778e3e8 100644
--- a/test/page.js
+++ b/test/page.js
@@ -8,6 +8,9 @@ var page = require('../').parse.page;
var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/PAGE.md'), 'utf8');
var LEXED = page(CONTENT);
+var HR_CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/HR_PAGE.md'), 'utf8');
+var HR_LEXED = page(HR_CONTENT);
+
describe('Page parsing', function() {
it('should detection sections', function() {
assert.equal(LEXED.length, 3);
@@ -31,4 +34,12 @@ describe('Page parsing', function() {
assert(LEXED[1].code.solution);
assert(LEXED[1].code.validation);
});
+
+ it('should merge sections correctly', function() {
+ // One big section
+ assert.equal(HR_LEXED.length, 1);
+
+ // HRs inserted correctly
+ assert.equal(HR_LEXED[0].content.match(/<hr>/g).length, 2);
+ });
});