diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-23 23:18:15 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-23 23:18:15 +0100 |
commit | 2d1aa15af8ee73f7179e323493ab4f6c40f6ac57 (patch) | |
tree | a71b44c602077c411b77cad554b0b47840294cfd /test/links.js | |
parent | 63ee94ff89d10e56d82079183c494f8129b92eae (diff) | |
download | gitbook-2d1aa15af8ee73f7179e323493ab4f6c40f6ac57.zip gitbook-2d1aa15af8ee73f7179e323493ab4f6c40f6ac57.tar.gz gitbook-2d1aa15af8ee73f7179e323493ab4f6c40f6ac57.tar.bz2 |
New cleaner helper for testing
Diffstat (limited to 'test/links.js')
-rw-r--r-- | test/links.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/test/links.js b/test/links.js deleted file mode 100644 index 2c68a23..0000000 --- a/test/links.js +++ /dev/null @@ -1,40 +0,0 @@ -var path = require('path'); -var _ = require('lodash'); -var assert = require('assert'); - -var links = require("../lib/utils/links"); - -describe('Links', function () { - it('should correctly test external links', function() { - assert(links.isExternal("http://google.fr")); - assert(links.isExternal("https://google.fr")); - assert(!links.isExternal("test.md")); - assert(!links.isExternal("folder/test.md")); - assert(!links.isExternal("/folder/test.md")); - }); - - it('should correctly test anchor links', function() { - assert(links.isAnchor("#test")); - assert(links.isAnchor(" #test")); - assert(!links.isAnchor("https://google.fr#test")); - assert(!links.isAnchor("test.md#test")); - }); - - describe('toAbsolute', function() { - it('should correctly transform as absolute', function() { - assert.equal(links.toAbsolute("http://google.fr"), "http://google.fr"); - assert.equal(links.toAbsolute("test.md", "./", "./"), "test.md"); - assert.equal(links.toAbsolute("folder/test.md", "./", "./"), "folder/test.md"); - }); - - it('should correctly handle windows path', function() { - assert.equal(links.toAbsolute("folder\\test.md", "./", "./"), "folder/test.md"); - }); - - it('should correctly handle absolute path', function() { - assert.equal(links.toAbsolute("/test.md", "./", "./"), "test.md"); - assert.equal(links.toAbsolute("/test.md", "test", "test"), "../test.md"); - assert.equal(links.toAbsolute("/sub/test.md", "test", "test"), "../sub/test.md"); - }); - }); -}); |