diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-25 11:28:21 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-25 11:28:21 +0200 |
commit | e1e4e7f01177d968e63f0b3a1830eda1adacb56b (patch) | |
tree | de1864bac7bce3f7e0c3a881b70e899a563347da /lib/utils/__tests__ | |
parent | 814b6ff489bc1f0bfd03db6409d49185e8c7b93e (diff) | |
download | gitbook-e1e4e7f01177d968e63f0b3a1830eda1adacb56b.zip gitbook-e1e4e7f01177d968e63f0b3a1830eda1adacb56b.tar.gz gitbook-e1e4e7f01177d968e63f0b3a1830eda1adacb56b.tar.bz2 |
Add tests for link resolution
Diffstat (limited to 'lib/utils/__tests__')
-rw-r--r-- | lib/utils/__tests__/location.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/utils/__tests__/location.js b/lib/utils/__tests__/location.js new file mode 100644 index 0000000..183086d --- /dev/null +++ b/lib/utils/__tests__/location.js @@ -0,0 +1,29 @@ +jest.autoMockOff(); + +describe('LocationUtils', function() { + var LocationUtils = require('../location'); + + describe('toAbsolute', function() { + + it('should resolve path starting by "/" in root directory', function() { + expect( + LocationUtils.toAbsolute('/test/hello.md', './', './') + ).toBe('test/hello.md'); + }); + + it('should resolve path starting by "/" in child directory', function() { + expect( + LocationUtils.toAbsolute('/test/hello.md', './hello', './') + ).toBe('test/hello.md'); + }); + + it('should resolve path starting by "/" in child directory, with same output directory', function() { + expect( + LocationUtils.toAbsolute('/test/hello.md', './hello', './hello') + ).toBe('../test/hello.md'); + }); + }); + +}); + + |