summaryrefslogtreecommitdiffstats
path: root/test/sections.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-10 02:27:42 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-10 02:27:42 -0700
commit04774df3724ba96a80a07371244c2d47426720c0 (patch)
treeb9b0a2018056b25aae4c35ff739cc5404337b9d7 /test/sections.js
parent619ded93adc01a870b8ee29722ff5e426c6fb8d7 (diff)
downloadgitbook-04774df3724ba96a80a07371244c2d47426720c0.zip
gitbook-04774df3724ba96a80a07371244c2d47426720c0.tar.gz
gitbook-04774df3724ba96a80a07371244c2d47426720c0.tar.bz2
Add better tests for ambiguous section detection
Diffstat (limited to 'test/sections.js')
-rw-r--r--test/sections.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/sections.js b/test/sections.js
new file mode 100644
index 0000000..ef4abf9
--- /dev/null
+++ b/test/sections.js
@@ -0,0 +1,22 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var lex = require('../').parse.lex;
+
+
+var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/SECTIONS.md'), 'utf8');
+var LEXED = lex(CONTENT);
+
+
+describe('Section parsing', function() {
+ it('should correctly split sections', function() {
+ assert.equal(LEXED.length, 3);
+ });
+
+ it('should robustly detect exercises', function() {
+ assert.equal(LEXED[0].type, 'normal');
+ assert.equal(LEXED[1].type, 'exercise');
+ assert.equal(LEXED[2].type, 'exercise');
+ });
+});