summaryrefslogtreecommitdiffstats
path: root/test/location.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/location.js')
-rw-r--r--test/location.js55
1 files changed, 0 insertions, 55 deletions
diff --git a/test/location.js b/test/location.js
deleted file mode 100644
index 3e2294e..0000000
--- a/test/location.js
+++ /dev/null
@@ -1,55 +0,0 @@
-var location = require('../lib/utils/location');
-
-describe('Location', function() {
- it('should correctly test external location', function() {
- location.isExternal('http://google.fr').should.be.exactly(true);
- location.isExternal('https://google.fr').should.be.exactly(true);
- location.isExternal('test.md').should.be.exactly(false);
- location.isExternal('folder/test.md').should.be.exactly(false);
- location.isExternal('/folder/test.md').should.be.exactly(false);
- });
-
- it('should correctly detect anchor location', function() {
- location.isAnchor('#test').should.be.exactly(true);
- location.isAnchor(' #test').should.be.exactly(true);
- location.isAnchor('https://google.fr#test').should.be.exactly(false);
- location.isAnchor('test.md#test').should.be.exactly(false);
- });
-
- describe('.relative', function() {
- it('should resolve to a relative path (same folder)', function() {
- location.relative('links/', 'links/test.md').should.equal('test.md');
- });
-
- it('should resolve to a relative path (parent folder)', function() {
- location.relative('links/', 'test.md').should.equal('../test.md');
- });
-
- it('should resolve to a relative path (child folder)', function() {
- location.relative('links/', 'links/hello/test.md').should.equal('hello/test.md');
- });
- });
-
- describe('.toAbsolute', function() {
- it('should correctly transform as absolute', function() {
- location.toAbsolute('http://google.fr').should.be.equal('http://google.fr');
- location.toAbsolute('test.md', './', './').should.be.equal('test.md');
- location.toAbsolute('folder/test.md', './', './').should.be.equal('folder/test.md');
- });
-
- it('should correctly handle windows path', function() {
- location.toAbsolute('folder\\test.md', './', './').should.be.equal('folder/test.md');
- });
-
- it('should correctly handle absolute path', function() {
- location.toAbsolute('/test.md', './', './').should.be.equal('test.md');
- location.toAbsolute('/test.md', 'test', 'test').should.be.equal('../test.md');
- location.toAbsolute('/sub/test.md', 'test', 'test').should.be.equal('../sub/test.md');
- location.toAbsolute('/test.png', 'folder', '').should.be.equal('test.png');
- });
-
- it('should correctly handle absolute path (windows)', function() {
- location.toAbsolute('\\test.png', 'folder', '').should.be.equal('test.png');
- });
- });
-});