summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-03-30 22:30:30 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-03-30 22:30:30 -0700
commit9284eb4115a38d1a45f12b343a4bf9a4cae90331 (patch)
tree921a8177a0a6fdae48680e74c6351ac8341ba144
parentcfbdadd6e412ae7affbf23f11a9de6a938b1a74b (diff)
downloadgitbook-9284eb4115a38d1a45f12b343a4bf9a4cae90331.zip
gitbook-9284eb4115a38d1a45f12b343a4bf9a4cae90331.tar.gz
gitbook-9284eb4115a38d1a45f12b343a4bf9a4cae90331.tar.bz2
Add basic page tests
-rw-r--r--test/fixtures/PAGE.MD30
-rw-r--r--test/page.js15
2 files changed, 45 insertions, 0 deletions
diff --git a/test/fixtures/PAGE.MD b/test/fixtures/PAGE.MD
new file mode 100644
index 0000000..79fc10c
--- /dev/null
+++ b/test/fixtures/PAGE.MD
@@ -0,0 +1,30 @@
+# Python basics
+
+Python is a nice language, you can add stuff. Bla bla bla.
+
+Lets jump into an exercise :
+
+---
+
+It's dead simple, `c` must be the sum of `a` and `b`
+
+```py
+a = 1
+b = 2
+```
+
+```py
+a = 1
+b = 2
+c = a + b
+```
+
+```py
+assert(c, 3)
+```
+
+---
+
+Some more nice content ....
+
+[Cool stuff](http://gitbook.io)
diff --git a/test/page.js b/test/page.js
new file mode 100644
index 0000000..9ed91bb
--- /dev/null
+++ b/test/page.js
@@ -0,0 +1,15 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var page = require('../lib/page');
+
+
+var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/PAGE.md'), 'utf8');
+var LEXED = page(CONTENT);
+
+describe('Page parsing', function() {
+ it('should detection sections', function() {
+ assert.equal(LEXED.length, 3);
+ });
+});