-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathurl_spec.ts
31 lines (25 loc) · 978 Bytes
/
url_spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { urlJoin } from './url';
describe('urlJoin', () => {
it('should work with absolute url with trailing slash', () => {
expect(urlJoin('http://foo.com/', '/one/')).toBe('http://foo.com/one/');
});
it('should work with absolute url without trailing slash', () => {
expect(urlJoin('http://foo.com', '/one')).toBe('http://foo.com/one');
});
it('should work with absolute url without slashes', () => {
expect(urlJoin('http://foo.com', 'one', 'two')).toBe('http://foo.com/one/two');
});
it('should work with relative url without slashes', () => {
expect(urlJoin('one', 'two', 'three')).toBe('one/two/three');
});
it('should keep trailing slash if empty path is provided', () => {
expect(urlJoin('one/', '')).toBe('one/');
});
});