diff options
Diffstat (limited to 'bin/wiki/ImportarDesdeURL/node_modules/is-uri/test/index.js')
-rw-r--r-- | bin/wiki/ImportarDesdeURL/node_modules/is-uri/test/index.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/bin/wiki/ImportarDesdeURL/node_modules/is-uri/test/index.js b/bin/wiki/ImportarDesdeURL/node_modules/is-uri/test/index.js new file mode 100644 index 00000000..e8fa8902 --- /dev/null +++ b/bin/wiki/ImportarDesdeURL/node_modules/is-uri/test/index.js @@ -0,0 +1,61 @@ +/* global describe, it */ + +'use strict' + +var isURI = require('..') +var should = require('should') + +var URLS = { + VALID: [ + 'http://google.com', + 'http://localhost/', + 'http://example.w3.org/path%20with%20spaces.html', + 'http://example.w3.org/%20', + 'ftp://ftp.is.co.za/rfc/rfc1808.txt', + 'ftp://ftp.is.co.za/../../../rfc/rfc1808.txt', + 'http://www.ietf.org/rfc/rfc2396.txt', + 'ldap://[2001:db8::7]/c=GB?objectClass?one', + 'mailto:John.Doe@example.com', + 'news:comp.infosystems.www.servers.unix', + 'tel:+1-816-555-1212', + 'telnet://192.0.2.16:80/', + 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2', + 'https://🐀.ws/🐀🐀', + 'magnet:?xt=urn:sha1:PDAQRAOQQRYS76MRZJ33LK4MMVZBDSCL' + ], + INVALID: [ + 5, + null, + undefined, + true, + NaN, + {}, + [], + function () {}, + '', + 'foo', + 'foo@bar', // no scheme + '://foo/', // empty scheme + '1http://foo', // invalid scheme + 'http://<foo>', // illegals + 'http:////foo.html', // invalid path, + 'http://example.w3.org/%illegal.html', + 'http://example.w3.org/%a', // incomplete hex escape + 'http://example.w3.org/%a/foo', // incomplete hex escape, + 'http://example.w3.org/%at' // incomplete hex escape + ] +} + +describe('parse uri', function () { + it('valid', function () { + URLS.VALID.forEach(function (url) { + isURI(url, {strictMode: true}).should.be.true() + }) + }) + + it('invalid', function () { + URLS.INVALID.forEach(function (url) { + isURI(url, {strictMode: true}).should.be.false() + }) + }) +}) |