23 lines
835 B
JavaScript
23 lines
835 B
JavaScript
|
var urljoin = require('../lib/url-join');
|
||
|
|
||
|
describe('url join', function () {
|
||
|
it('should work for simple case', function () {
|
||
|
urljoin('http://www.google.com/', 'foo/bar', '?test=123')
|
||
|
.should.eql('http://www.google.com/foo/bar?test=123');
|
||
|
});
|
||
|
|
||
|
it('should be able to join protocol', function () {
|
||
|
urljoin('http:', 'www.google.com/', 'foo/bar', '?test=123')
|
||
|
.should.eql('http://www.google.com/foo/bar?test=123');
|
||
|
});
|
||
|
|
||
|
it('should remove extra slashes', function () {
|
||
|
urljoin('http:', 'www.google.com///', 'foo/bar', '?test=123')
|
||
|
.should.eql('http://www.google.com/foo/bar?test=123');
|
||
|
});
|
||
|
|
||
|
it('should support anchors in urls', function () {
|
||
|
urljoin('http:', 'www.google.com///', 'foo/bar', '?test=123', '#faaaaa')
|
||
|
.should.eql('http://www.google.com/foo/bar?test=123#faaaaa');
|
||
|
});
|
||
|
});
|