summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-06-29 10:32:49 +0200
committerSamy Pessé <samypesse@gmail.com>2016-06-29 10:32:49 +0200
commit936fa1545baff831026a82d0f8649ea8b595a74b (patch)
tree3f41d7f3b43e1d6aae79e7869f57a523c8e2d48d /lib
parentc9c2dde2b63505177265c66b1a6c4dd358415416 (diff)
downloadgitbook-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.js15
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');