aboutsummaryrefslogtreecommitdiff
path: root/node_modules/is-url/test/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/is-url/test/index.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/is-url/test/index.js')
-rw-r--r--node_modules/is-url/test/index.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/is-url/test/index.js b/node_modules/is-url/test/index.js
index 5f7aebce1..404e1b6f0 100644
--- a/node_modules/is-url/test/index.js
+++ b/node_modules/is-url/test/index.js
@@ -118,5 +118,32 @@ describe('is-url', function () {
it('google.com', function () {
assert(!url('google.com'));
});
+
+ it('empty', function () {
+ assert(!url(''));
+ });
+
+ it('undef', function () {
+ assert(!url(undefined));
+ });
+
+ it('object', function () {
+ assert(!url({}));
+ });
+
+ it('re', function () {
+ assert(!url(/abc/));
+ });
+ });
+
+ describe('redos', function () {
+ it('redos exploit', function () {
+ // Invalid. This should be discovered in under 1 second.
+ var attackString = 'a://localhost' + '9'.repeat(100000) + '\t';
+ var before = process.hrtime();
+ assert(!url(attackString), 'attackString was valid');
+ var elapsed = process.hrtime(before);
+ assert(elapsed[0] < 1, 'attackString took ' + elapsed[0] + ' > 1 seconds');
+ });
});
});