summaryrefslogtreecommitdiffstats
path: root/test/page.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/page.js')
-rw-r--r--test/page.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/page.js b/test/page.js
index 778e3e8..68c0749 100644
--- a/test/page.js
+++ b/test/page.js
@@ -11,6 +11,9 @@ var LEXED = page(CONTENT);
var HR_CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/HR_PAGE.md'), 'utf8');
var HR_LEXED = page(HR_CONTENT);
+var LINKS_CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GITHUB_LINKS.md'), 'utf8');
+
+
describe('Page parsing', function() {
it('should detection sections', function() {
assert.equal(LEXED.length, 3);
@@ -43,3 +46,18 @@ describe('Page parsing', function() {
assert.equal(HR_LEXED[0].content.match(/<hr>/g).length, 2);
});
});
+
+
+describe('Relative links', function() {
+ it('should be resolved to their GitHub counterparts', function() {
+ var LEXED = page(LINKS_CONTENT, {
+ // GitHub repo ID
+ repo: 'GitBookIO/javascript',
+
+ // Imaginary folder of markdown file
+ dir: 'course',
+ });
+
+ assert(LEXED[0].content.indexOf('https://github.com/GitBookIO/javascript/blob/src/something.cpp') !== -1);
+ });
+});