diff options
| author | Jez Ng | 2012-09-08 16:37:05 -0400 | 
|---|---|---|
| committer | Jez Ng | 2012-09-08 16:37:05 -0400 | 
| commit | adf8b7cc617279e50594477560ec7031e2ab68ea (patch) | |
| tree | f43660994fb29770bd38e4b11cc11d828ecc0615 /tests/unit_tests/utils_test.coffee | |
| parent | 3e5bba24ede4f9392ff666634a0a8f05e21a02d1 (diff) | |
| parent | e740ea52b646f1b7cd0ef13e15571b20adaa3bd8 (diff) | |
| download | vimium-adf8b7cc617279e50594477560ec7031e2ab68ea.tar.bz2 | |
Merge branch 'next-release'
Diffstat (limited to 'tests/unit_tests/utils_test.coffee')
| -rw-r--r-- | tests/unit_tests/utils_test.coffee | 22 | 
1 files changed, 22 insertions, 0 deletions
| diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee index 6a44b460..9da5ff65 100644 --- a/tests/unit_tests/utils_test.coffee +++ b/tests/unit_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/") | 
