diff options
| author | Jez Ng | 2012-09-06 10:40:30 -0400 |
|---|---|---|
| committer | Jez Ng | 2012-09-06 10:40:30 -0400 |
| commit | e932e28c6ee3376fc3e2c87f07637f123817e0c9 (patch) | |
| tree | 2efa30068e871f0b7d4d6b0a8decaef1340d711c /tests | |
| parent | eb0955875ba6ba77a90b1e411c42be0df6de950d (diff) | |
| parent | 95d538d0458ae6206a791edead92cd0e4b1e3990 (diff) | |
| download | vimium-e932e28c6ee3376fc3e2c87f07637f123817e0c9.tar.bz2 | |
Merge remote-tracking branch 'liesen/idiomatic-coffee-utils' into next-release
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/utils_test.coffee | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/utils_test.coffee b/tests/utils_test.coffee index c5e5d002..f3810114 100644 --- a/tests/utils_test.coffee +++ b/tests/utils_test.coffee @@ -1,6 +1,28 @@ require "./test_helper.js" extend(global, require "../lib/utils.js") +context "isUrl", + should "accept valid URLs", -> + assert.isTrue Utils.isUrl "www.google.com" + assert.isTrue Utils.isUrl "www.bbc.co.uk" + assert.isTrue Utils.isUrl "yahoo.com" + assert.isTrue Utils.isUrl "nunames.nu" + assert.isTrue Utils.isUrl "user:pass@ftp.xyz.com/test" + + assert.isTrue Utils.isUrl "localhost/index.html" + assert.isTrue Utils.isUrl "127.0.0.1:8192/test.php" + + # IPv6 + assert.isTrue Utils.isUrl "[::]:9000" + + # Long TLDs + assert.isTrue Utils.isUrl "illinois.state.museum" + assert.isTrue Utils.isUrl "eqt5g4fuenphqinx.onion" + + should "reject invalid URLs", -> + assert.isFalse Utils.isUrl "a.x" + assert.isFalse Utils.isUrl "www-domain-tld" + context "convertToUrl", should "detect and clean up valid URLs", -> assert.equal "http://www.google.com/", Utils.convertToUrl("http://www.google.com/") |
