mirror of
https://github.com/arnaucube/socketioMEANseed.git
synced 2026-02-07 19:56:46 +01:00
init
This commit is contained in:
51
www/node_modules/url-join/test/tests.js
generated
vendored
Normal file
51
www/node_modules/url-join/test/tests.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
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 work for simple case with new syntax', function () {
|
||||
urljoin(['http://www.google.com/', 'foo/bar', '?test=123'])
|
||||
.should.eql('http://www.google.com/foo/bar?test=123');
|
||||
});
|
||||
|
||||
it('should work for hashbang urls', 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 be able to join protocol with slashes', 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');
|
||||
});
|
||||
|
||||
it('should support protocol-relative urls', function () {
|
||||
urljoin('//www.google.com', 'foo/bar', '?test=123')
|
||||
.should.eql('//www.google.com/foo/bar?test=123')
|
||||
});
|
||||
|
||||
it('should merge multiple query params properly', function () {
|
||||
urljoin('http:', 'www.google.com///', 'foo/bar', '?test=123', '?key=456')
|
||||
.should.eql('http://www.google.com/foo/bar?test=123&key=456');
|
||||
|
||||
urljoin('http:', 'www.google.com///', 'foo/bar', '?test=123', '?boom=value', '&key=456')
|
||||
.should.eql('http://www.google.com/foo/bar?test=123&boom=value&key=456');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user