summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-02 18:38:01 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-02 18:40:53 -0700
commit8fc09e2e05701d3832de2940ae45949a107c5ecb (patch)
tree8d56fdf3d60201a8440957711aa2f7abe5794bb3
parented7798237ab7f6d17989f8d919e16be105c4ffae (diff)
downloadgitbook-8fc09e2e05701d3832de2940ae45949a107c5ecb.zip
gitbook-8fc09e2e05701d3832de2940ae45949a107c5ecb.tar.gz
gitbook-8fc09e2e05701d3832de2940ae45949a107c5ecb.tar.bz2
Add github link resolution test
-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);
+ });
+});