summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-markdown/test/page.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-markdown/test/page.js')
-rw-r--r--packages/gitbook-markdown/test/page.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/packages/gitbook-markdown/test/page.js b/packages/gitbook-markdown/test/page.js
index 8f4b5c5..8b882d8 100644
--- a/packages/gitbook-markdown/test/page.js
+++ b/packages/gitbook-markdown/test/page.js
@@ -4,25 +4,22 @@ var assert = require('assert');
var page = require('../').page;
-function loadPage (name, options) {
- var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/' + name + '.md'), 'utf8');
- return page(CONTENT, options).sections;
-}
-
-var LEXED = loadPage('PAGE');
describe('Page parsing', function() {
- it('should detect sections', function() {
- assert.equal(LEXED.length, 1);
+ var LEXED;
+
+ before(function() {
+ var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/PAGE.md'), 'utf8');
+ LEXED = page(CONTENT);
});
- it('should gen content for normal sections', function() {
- assert(LEXED[0].content);
+ it('should gen content', function() {
+ assert(LEXED.content);
});
it('should not add id to headings', function() {
- assert.equal(page('# Hello').sections[0].content, '<h1>Hello</h1>\n');
- assert.equal(page('# Hello {#test}').sections[0].content, '<h1 id="test">Hello </h1>\n');
+ assert.equal(page('# Hello').content, '<h1>Hello</h1>\n');
+ assert.equal(page('# Hello {#test}').content, '<h1 id="test">Hello </h1>\n');
});
it('should escape codeblocks in preparation (1)', function() {