feat: Ajout d'un système d'alert
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
5
scripts/production/node_modules/url-join/.travis.yml
generated
vendored
Normal file
5
scripts/production/node_modules/url-join/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "5"
|
||||
- "4"
|
||||
- "0.12"
|
88
scripts/production/node_modules/url-join/CHANGELOG.md
generated
vendored
Normal file
88
scripts/production/node_modules/url-join/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
## 4.0.0 - 2018-02-02
|
||||
|
||||
- Ignore empty string arguments and throw an exception for non-string. Closes #36, #18 ([da05242f381bfe1ae09d00b708cfdbdb93c1a85d](https://github.com/jfromaniello/url-join/commit/da05242f381bfe1ae09d00b708cfdbdb93c1a85d)), closes [#36](https://github.com/jfromaniello/url-join/issues/36) [#18](https://github.com/jfromaniello/url-join/issues/18)
|
||||
|
||||
|
||||
|
||||
## 3.0.0 - 2018-01-12
|
||||
|
||||
- add new test ([d65d7c1696cb53b53ceabadf1a77917196967b4c](https://github.com/jfromaniello/url-join/commit/d65d7c1696cb53b53ceabadf1a77917196967b4c))
|
||||
- Fixed to handle the colon in non-protocol separation role in the first part. ([9212db75f805031a9cc06120b5dd08a6cdd805e4](https://github.com/jfromaniello/url-join/commit/9212db75f805031a9cc06120b5dd08a6cdd805e4))
|
||||
|
||||
|
||||
|
||||
## 2.0.5 - 2018-01-10
|
||||
|
||||
- revert to previous behavior #30 ([b6943343af7bd723cbca266388e84e036543577d](https://github.com/jfromaniello/url-join/commit/b6943343af7bd723cbca266388e84e036543577d)), closes [#30](https://github.com/jfromaniello/url-join/issues/30)
|
||||
|
||||
|
||||
|
||||
## 2.0.4 - 2018-01-10
|
||||
|
||||
- fix bower.json ([9677895a4afe51d8a1d670980bc6fede71252e9a](https://github.com/jfromaniello/url-join/commit/9677895a4afe51d8a1d670980bc6fede71252e9a))
|
||||
|
||||
|
||||
|
||||
## 2.0.3 - 2018-01-09
|
||||
|
||||
- 2.0.3 ([7b7806b21cf81a3476e39ddb8a6f51272a276186](https://github.com/jfromaniello/url-join/commit/7b7806b21cf81a3476e39ddb8a6f51272a276186))
|
||||
- Added a test for simple paths for issue #21 ([be99b10a707b4d22aac015d19eb087fff46d4270](https://github.com/jfromaniello/url-join/commit/be99b10a707b4d22aac015d19eb087fff46d4270)), closes [#21](https://github.com/jfromaniello/url-join/issues/21)
|
||||
- Added some new tests for cases that fail. ([f1afbd62c3149476a9ef099ba523e85fb4839732](https://github.com/jfromaniello/url-join/commit/f1afbd62c3149476a9ef099ba523e85fb4839732))
|
||||
- Passes all the tests with these changes. ([8cde667f400fa83efc7ed5c2437c7cb25c7d7600](https://github.com/jfromaniello/url-join/commit/8cde667f400fa83efc7ed5c2437c7cb25c7d7600))
|
||||
- The protocol slashes should be normalized also when the protocol is not alone in the first argument. ([0ce1239c60f7bbb625d4ccbf1fcf044f37488bd8](https://github.com/jfromaniello/url-join/commit/0ce1239c60f7bbb625d4ccbf1fcf044f37488bd8))
|
||||
|
||||
|
||||
|
||||
## 2.0.2 - 2017-05-18
|
||||
|
||||
- fix: remove consecutives slashes ([33639364ef186e257b8424620017b9d1ba225539](https://github.com/jfromaniello/url-join/commit/33639364ef186e257b8424620017b9d1ba225539))
|
||||
|
||||
|
||||
|
||||
## 2.0.1 - 2017-04-12
|
||||
|
||||
- update mocha and bower.json ([ebd3665028b2408d405f9a31f8479e91c4ef52c1](https://github.com/jfromaniello/url-join/commit/ebd3665028b2408d405f9a31f8479e91c4ef52c1))
|
||||
- feat: add test ([46d3387141e5d2f751da699e02d57fc36bfe37a8](https://github.com/jfromaniello/url-join/commit/46d3387141e5d2f751da699e02d57fc36bfe37a8))
|
||||
- fix: ignore encoded url when removing consecusive slashes ([711add4e8af8fc97390adef14b9a4722cac5e70a](https://github.com/jfromaniello/url-join/commit/711add4e8af8fc97390adef14b9a4722cac5e70a))
|
||||
|
||||
|
||||
|
||||
## 2.0.0 - 2017-04-11
|
||||
|
||||
- Add a LICENSE file ([ffd3b2253470cee648152c55dd51c1bf4e688a60](https://github.com/jfromaniello/url-join/commit/ffd3b2253470cee648152c55dd51c1bf4e688a60))
|
||||
- change copyright year ([9f67671dd8ab23b4d2da6ae775efdf66d594eac3](https://github.com/jfromaniello/url-join/commit/9f67671dd8ab23b4d2da6ae775efdf66d594eac3))
|
||||
- refactor: use local startsWith function ([a1e1214644cd187f2584b79b4241ac3b8c9b9f1b](https://github.com/jfromaniello/url-join/commit/a1e1214644cd187f2584b79b4241ac3b8c9b9f1b))
|
||||
- fix: split logic for files ([d7053a99aa40b0c2f4802819f7e0643be8889ac4](https://github.com/jfromaniello/url-join/commit/d7053a99aa40b0c2f4802819f7e0643be8889ac4))
|
||||
- feat: add file protocol support ([48ebe0d84e8e2eca3a02fe5e3259cdd294e519dc](https://github.com/jfromaniello/url-join/commit/48ebe0d84e8e2eca3a02fe5e3259cdd294e519dc))
|
||||
|
||||
|
||||
|
||||
## 1.1.0 - 2016-04-05
|
||||
|
||||
- add .travis.yml ([c75e7507f72fd4be101b64bb44539fd249842cc0](https://github.com/jfromaniello/url-join/commit/c75e7507f72fd4be101b64bb44539fd249842cc0))
|
||||
- added new syntax to allow options, fixed #! urls ([b8e5d8372c55187cdd9c6fa5e02830f76858347e](https://github.com/jfromaniello/url-join/commit/b8e5d8372c55187cdd9c6fa5e02830f76858347e))
|
||||
- added travis, updated version in bower.json ([5a58405d89298e693e8f97a74b14324d83a8a87a](https://github.com/jfromaniello/url-join/commit/5a58405d89298e693e8f97a74b14324d83a8a87a))
|
||||
- fixed query string handling, closes #9, closes #4 ([e190fe28282287204dbe7877979f18b4570042f9](https://github.com/jfromaniello/url-join/commit/e190fe28282287204dbe7877979f18b4570042f9)), closes [#9](https://github.com/jfromaniello/url-join/issues/9) [#4](https://github.com/jfromaniello/url-join/issues/4)
|
||||
|
||||
|
||||
|
||||
## 1.0.0 - 2016-03-23
|
||||
|
||||
|
||||
|
||||
|
||||
## 0.1.0 - 2016-03-23
|
||||
|
||||
- 0.1.0 ([2db128d268dfd531f1af6c9bd0543458387e94cd](https://github.com/jfromaniello/url-join/commit/2db128d268dfd531f1af6c9bd0543458387e94cd))
|
||||
- add support for AMD and windows['url-join'] ([b02169596877a1e6cd518f1b0d711f38c721fb02](https://github.com/jfromaniello/url-join/commit/b02169596877a1e6cd518f1b0d711f38c721fb02))
|
||||
- added comments, fixed leading // ([3f72b6ea6fa84c4b254d0c656815a5df6b89a10a](https://github.com/jfromaniello/url-join/commit/3f72b6ea6fa84c4b254d0c656815a5df6b89a10a))
|
||||
- added test for leading // ([baac627b2052e1d9b5c05e48c8dc6a05a80e08fa](https://github.com/jfromaniello/url-join/commit/baac627b2052e1d9b5c05e48c8dc6a05a80e08fa))
|
||||
- bower init ([650dcfe72eee854108dd0832963553eae5ede7c5](https://github.com/jfromaniello/url-join/commit/650dcfe72eee854108dd0832963553eae5ede7c5))
|
||||
- initial ([af68a208966de3d4be757c9d0f4a918c6dfa360e](https://github.com/jfromaniello/url-join/commit/af68a208966de3d4be757c9d0f4a918c6dfa360e))
|
||||
- minor ([dde2dc6815f9a0476d7aade1d6848cbc5f3a14a4](https://github.com/jfromaniello/url-join/commit/dde2dc6815f9a0476d7aade1d6848cbc5f3a14a4))
|
||||
- minor ([4d9d8ee16591da2092739a172145f968f71598dc](https://github.com/jfromaniello/url-join/commit/4d9d8ee16591da2092739a172145f968f71598dc))
|
||||
- minor ([9ed0161497ee7d7d1b4b04d1735483a6216fe2c6](https://github.com/jfromaniello/url-join/commit/9ed0161497ee7d7d1b4b04d1735483a6216fe2c6))
|
||||
- simplify normalize function ([d6886a362828eacc028c6167b9ae0efd8b2fbfc8](https://github.com/jfromaniello/url-join/commit/d6886a362828eacc028c6167b9ae0efd8b2fbfc8))
|
||||
|
||||
|
||||
|
21
scripts/production/node_modules/url-join/LICENSE
generated
vendored
Normal file
21
scripts/production/node_modules/url-join/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015 José F. Romaniello
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
47
scripts/production/node_modules/url-join/README.md
generated
vendored
Normal file
47
scripts/production/node_modules/url-join/README.md
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
Join all arguments together and normalize the resulting url.
|
||||
|
||||
## Install
|
||||
|
||||
~~~
|
||||
npm install url-join
|
||||
~~~
|
||||
|
||||
## Usage
|
||||
|
||||
~~~javascript
|
||||
var urljoin = require('url-join');
|
||||
|
||||
var fullUrl = urljoin('http://www.google.com', 'a', '/b/cd', '?foo=123');
|
||||
|
||||
console.log(fullUrl);
|
||||
|
||||
~~~
|
||||
|
||||
Prints:
|
||||
|
||||
~~~
|
||||
'http://www.google.com/a/b/cd?foo=123'
|
||||
~~~
|
||||
|
||||
## Browser and AMD
|
||||
|
||||
It also works in the browser, you can either include ```lib/url-join.js``` in your page:
|
||||
|
||||
~~~html
|
||||
<script src="url-join.js"></script>
|
||||
<script type="text/javascript">
|
||||
urljoin('http://blabla.com', 'foo?a=1')
|
||||
</script>
|
||||
~~~
|
||||
|
||||
Or using an AMD module system like requirejs:
|
||||
|
||||
~~~javascript
|
||||
define(['path/url-join.js'], function (urljoin) {
|
||||
urljoin('http://blabla.com', 'foo?a=1');
|
||||
});
|
||||
~~~
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
28
scripts/production/node_modules/url-join/bin/changelog
generated
vendored
Executable file
28
scripts/production/node_modules/url-join/bin/changelog
generated
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var changelog = require('conventional-changelog');
|
||||
var semver_regex = /\bv?(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?\b/ig;
|
||||
|
||||
const commitPartial = ` - {{header}}
|
||||
|
||||
{{~!-- commit hash --}} {{#if @root.linkReferences}}([{{hash}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/{{@root.commit}}/{{hash}})){{else}}{{hash~}}{{/if}}
|
||||
|
||||
{{~!-- commit references --}}{{#if references}}, closes{{~#each references}} {{#if @root.linkReferences}}[{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if this.repository}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}{{else}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}{{/if}}/{{@root.issue}}/{{this.issue}}){{else}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}{{/if}}{{/each}}{{/if}}
|
||||
`;
|
||||
|
||||
const headerPartial = `## {{version}}{{#if title}} "{{title}}"{{/if}}{{#if date}} - {{date}}{{/if}}
|
||||
`;
|
||||
|
||||
changelog({
|
||||
releaseCount: 19,
|
||||
// preset: 'jshint'
|
||||
}, null, null, null, {
|
||||
transform: function (commit) {
|
||||
if (commit.header && semver_regex.exec(commit.header)) {
|
||||
return null;
|
||||
}
|
||||
return commit;
|
||||
},
|
||||
commitPartial: commitPartial,
|
||||
headerPartial: headerPartial
|
||||
}).pipe(process.stdout);
|
78
scripts/production/node_modules/url-join/lib/url-join.js
generated
vendored
Normal file
78
scripts/production/node_modules/url-join/lib/url-join.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
(function (name, context, definition) {
|
||||
if (typeof module !== 'undefined' && module.exports) module.exports = definition();
|
||||
else if (typeof define === 'function' && define.amd) define(definition);
|
||||
else context[name] = definition();
|
||||
})('urljoin', this, function () {
|
||||
|
||||
function normalize (strArray) {
|
||||
var resultArray = [];
|
||||
if (strArray.length === 0) { return ''; }
|
||||
|
||||
if (typeof strArray[0] !== 'string') {
|
||||
throw new TypeError('Url must be a string. Received ' + strArray[0]);
|
||||
}
|
||||
|
||||
// If the first part is a plain protocol, we combine it with the next part.
|
||||
if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
|
||||
var first = strArray.shift();
|
||||
strArray[0] = first + strArray[0];
|
||||
}
|
||||
|
||||
// There must be two or three slashes in the file protocol, two slashes in anything else.
|
||||
if (strArray[0].match(/^file:\/\/\//)) {
|
||||
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1:///');
|
||||
} else {
|
||||
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1://');
|
||||
}
|
||||
|
||||
for (var i = 0; i < strArray.length; i++) {
|
||||
var component = strArray[i];
|
||||
|
||||
if (typeof component !== 'string') {
|
||||
throw new TypeError('Url must be a string. Received ' + component);
|
||||
}
|
||||
|
||||
if (component === '') { continue; }
|
||||
|
||||
if (i > 0) {
|
||||
// Removing the starting slashes for each component but the first.
|
||||
component = component.replace(/^[\/]+/, '');
|
||||
}
|
||||
if (i < strArray.length - 1) {
|
||||
// Removing the ending slashes for each component but the last.
|
||||
component = component.replace(/[\/]+$/, '');
|
||||
} else {
|
||||
// For the last component we will combine multiple slashes to a single one.
|
||||
component = component.replace(/[\/]+$/, '/');
|
||||
}
|
||||
|
||||
resultArray.push(component);
|
||||
|
||||
}
|
||||
|
||||
var str = resultArray.join('/');
|
||||
// Each input component is now separated by a single slash except the possible first plain protocol part.
|
||||
|
||||
// remove trailing slash before parameters or hash
|
||||
str = str.replace(/\/(\?|&|#[^!])/g, '$1');
|
||||
|
||||
// replace ? in parameters with &
|
||||
var parts = str.split('?');
|
||||
str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
return function () {
|
||||
var input;
|
||||
|
||||
if (typeof arguments[0] === 'object') {
|
||||
input = arguments[0];
|
||||
} else {
|
||||
input = [].slice.call(arguments);
|
||||
}
|
||||
|
||||
return normalize(input);
|
||||
};
|
||||
|
||||
});
|
24
scripts/production/node_modules/url-join/package.json
generated
vendored
Normal file
24
scripts/production/node_modules/url-join/package.json
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "url-join",
|
||||
"version": "4.0.1",
|
||||
"description": "Join urls and normalize as in path.join.",
|
||||
"main": "lib/url-join.js",
|
||||
"scripts": {
|
||||
"test": "mocha --require should"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jfromaniello/url-join.git"
|
||||
},
|
||||
"keywords": [
|
||||
"url",
|
||||
"join"
|
||||
],
|
||||
"author": "José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"conventional-changelog": "^1.1.10",
|
||||
"mocha": "^3.2.0",
|
||||
"should": "~1.2.1"
|
||||
}
|
||||
}
|
151
scripts/production/node_modules/url-join/test/tests.js
generated
vendored
Normal file
151
scripts/production/node_modules/url-join/test/tests.js
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
var urljoin = require('../lib/url-join');
|
||||
var assert = require('assert');
|
||||
|
||||
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 not remove extra slashes in an encoded URL', function () {
|
||||
urljoin('http:', 'www.google.com///', 'foo/bar', '?url=http%3A//Ftest.com')
|
||||
.should.eql('http://www.google.com/foo/bar?url=http%3A//Ftest.com');
|
||||
|
||||
urljoin('http://a.com/23d04b3/', '/b/c.html')
|
||||
.should.eql('http://a.com/23d04b3/b/c.html')
|
||||
.should.not.eql('http://a.com/23d04b3//b/c.html');
|
||||
});
|
||||
|
||||
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 support file protocol urls', function () {
|
||||
urljoin('file:/', 'android_asset', 'foo/bar')
|
||||
.should.eql('file://android_asset/foo/bar')
|
||||
|
||||
urljoin('file:', '/android_asset', 'foo/bar')
|
||||
.should.eql('file://android_asset/foo/bar')
|
||||
});
|
||||
|
||||
it('should support absolute file protocol urls', function () {
|
||||
urljoin('file:', '///android_asset', 'foo/bar')
|
||||
.should.eql('file:///android_asset/foo/bar')
|
||||
|
||||
urljoin('file:///', 'android_asset', 'foo/bar')
|
||||
.should.eql('file:///android_asset/foo/bar')
|
||||
|
||||
urljoin('file:///', '//android_asset', 'foo/bar')
|
||||
.should.eql('file:///android_asset/foo/bar')
|
||||
|
||||
urljoin('file:///android_asset', 'foo/bar')
|
||||
.should.eql('file:///android_asset/foo/bar')
|
||||
});
|
||||
|
||||
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');
|
||||
|
||||
urljoin('http://example.org/x', '?a=1', '?b=2', '?c=3', '?d=4')
|
||||
.should.eql('http://example.org/x?a=1&b=2&c=3&d=4');
|
||||
});
|
||||
|
||||
it('should merge slashes in paths correctly', function () {
|
||||
urljoin('http://example.org', 'a//', 'b//', 'A//', 'B//')
|
||||
.should.eql('http://example.org/a/b/A/B/');
|
||||
});
|
||||
|
||||
it('should merge colons in paths correctly', function () {
|
||||
urljoin('http://example.org/', ':foo:', 'bar')
|
||||
.should.eql('http://example.org/:foo:/bar');
|
||||
});
|
||||
|
||||
it('should merge just a simple path without URL correctly', function() {
|
||||
urljoin('/', 'test')
|
||||
.should.eql('/test');
|
||||
});
|
||||
|
||||
it('should fail with segments that are not string', function() {
|
||||
assert.throws(() => urljoin(true),
|
||||
/Url must be a string. Received true/);
|
||||
assert.throws(() => urljoin('http://blabla.com/', 1),
|
||||
/Url must be a string. Received 1/);
|
||||
assert.throws(() => urljoin('http://blabla.com/', undefined, 'test'),
|
||||
/Url must be a string. Received undefined/);
|
||||
assert.throws(() => urljoin('http://blabla.com/', null, 'test'),
|
||||
/Url must be a string. Received null/);
|
||||
assert.throws(() => urljoin('http://blabla.com/', { foo: 123 }, 'test'),
|
||||
/Url must be a string. Received \[object Object\]/);
|
||||
});
|
||||
|
||||
it('should merge a path with colon properly', function(){
|
||||
urljoin('/users/:userId', '/cars/:carId')
|
||||
.should.eql('/users/:userId/cars/:carId');
|
||||
});
|
||||
|
||||
it('should merge slashes in protocol correctly', function () {
|
||||
urljoin('http://example.org', 'a')
|
||||
.should.eql('http://example.org/a');
|
||||
urljoin('http:', '//example.org', 'a')
|
||||
.should.eql('http://example.org/a');
|
||||
urljoin('http:///example.org', 'a')
|
||||
.should.eql('http://example.org/a');
|
||||
urljoin('file:///example.org', 'a')
|
||||
.should.eql('file:///example.org/a');
|
||||
|
||||
urljoin('file:example.org', 'a')
|
||||
.should.eql('file://example.org/a');
|
||||
|
||||
urljoin('file:/', 'example.org', 'a')
|
||||
.should.eql('file://example.org/a');
|
||||
urljoin('file:', '/example.org', 'a')
|
||||
.should.eql('file://example.org/a');
|
||||
urljoin('file:', '//example.org', 'a')
|
||||
.should.eql('file://example.org/a');
|
||||
});
|
||||
|
||||
it('should skip empty strings', function() {
|
||||
urljoin('http://foobar.com', '', 'test')
|
||||
.should.eql('http://foobar.com/test');
|
||||
urljoin('', 'http://foobar.com', '', 'test')
|
||||
.should.eql('http://foobar.com/test');
|
||||
});
|
||||
|
||||
it('should return an empty string if no arguments are supplied', function() {
|
||||
urljoin().should.eql('');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user