diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-06-29 10:32:49 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-06-29 10:32:49 +0200 |
commit | 936fa1545baff831026a82d0f8649ea8b595a74b (patch) | |
tree | 3f41d7f3b43e1d6aae79e7869f57a523c8e2d48d /lib | |
parent | c9c2dde2b63505177265c66b1a6c4dd358415416 (diff) | |
download | gitbook-936fa1545baff831026a82d0f8649ea8b595a74b.zip gitbook-936fa1545baff831026a82d0f8649ea8b595a74b.tar.gz gitbook-936fa1545baff831026a82d0f8649ea8b595a74b.tar.bz2 |
Add tests for locationUtils.flatten
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/__tests__/location.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/utils/__tests__/location.js b/lib/utils/__tests__/location.js index 2d01714..822338e 100644 --- a/lib/utils/__tests__/location.js +++ b/lib/utils/__tests__/location.js @@ -39,6 +39,21 @@ describe('LocationUtils', function() { }); }); + describe('.flatten', function() { + it('should remove leading slash', function() { + expect(LocationUtils.flatten('/test.md')).toBe('test.md'); + expect(LocationUtils.flatten('/hello/cool.md')).toBe('hello/cool.md'); + }); + + it('should remove leading slashes', function() { + expect(LocationUtils.flatten('///test.md')).toBe('test.md'); + }); + + it('should not break paths', function() { + expect(LocationUtils.flatten('hello/cool.md')).toBe('hello/cool.md'); + }); + }); + describe('.toAbsolute', function() { it('should correctly transform as absolute', function() { expect(LocationUtils.toAbsolute('http://google.fr')).toBe('http://google.fr'); |