From 4bdcfd07a97de370aead0cbb8a9707568c9e4138 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Wed, 2 Apr 2014 16:40:15 -0700 Subject: [PATCH] Add tests for section merging --- test/page.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/page.js b/test/page.js index 082cda6bf..778e3e8de 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(/
/g).length, 2); + }); });