diff options
Diffstat (limited to 'lib/utils/__tests__/location.js')
-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'); + }); + }); + +}); + + |