blob: 2a427f5acd443044f879ef4f320a61aa40a36f5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
var combineURLs = require('../../../lib/helpers/combineURLs');
describe('helpers::combineURLs', function () {
it('should combine URLs', function () {
expect(combineURLs('https://api.github.com', '/users')).toBe('https://api.github.com/users');
});
it('should remove duplicate slashes', function () {
expect(combineURLs('https://api.github.com/', '/users')).toBe('https://api.github.com/users');
});
it('should insert missing slash', function () {
expect(combineURLs('https://api.github.com', 'users')).toBe('https://api.github.com/users');
});
it('should not insert slash when relative url missing/empty', function () {
expect(combineURLs('https://api.github.com/users', '')).toBe('https://api.github.com/users');
});
it('should allow a single slash for relative url', function () {
expect(combineURLs('https://api.github.com/users', '/')).toBe('https://api.github.com/users/');
});
});
|