diff options
| author | Stephen Blott | 2014-11-08 07:40:49 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-11-08 07:40:49 +0000 | 
| commit | 3d647c9d062a84082d0337ac0b0004d31eb64969 (patch) | |
| tree | 9ff193d27f26d931b06018e36662cde2faef2a91 /tests | |
| parent | 8e4e95c87d2ea06fcc0d9d354a180dfa1f31cdd2 (diff) | |
| parent | 56565a021ae421d648a3b4180fdd255270245421 (diff) | |
| download | vimium-3d647c9d062a84082d0337ac0b0004d31eb64969.tar.bz2 | |
Merge branch 'smblott-github-domains-only-domains'
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit_tests/completion_test.coffee | 12 | ||||
| -rw-r--r-- | tests/unit_tests/utils_test.coffee | 7 | 
2 files changed, 13 insertions, 6 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index 811436a9..44989267 100644 --- a/tests/unit_tests/completion_test.coffee +++ b/tests/unit_tests/completion_test.coffee @@ -163,13 +163,13 @@ context "domain completer",    should "return only a single matching domain", ->      results = filterCompleter(@completer, ["story"]) -    assert.arrayEqual ["history1.com"], results.map (result) -> result.url +    assert.arrayEqual ["http://history1.com"], results.map (result) -> result.url    should "pick domains which are more recent", ->      # These domains are the same except for their last visited time. -    assert.equal "history1.com", filterCompleter(@completer, ["story"])[0].url +    assert.equal "http://history1.com", filterCompleter(@completer, ["story"])[0].url      @history2.lastVisitTime = hours(3) -    assert.equal "history2.com", filterCompleter(@completer, ["story"])[0].url +    assert.equal "http://history2.com", filterCompleter(@completer, ["story"])[0].url    should "returns no results when there's more than one query term, because clearly it's not a domain", ->      assert.arrayEqual [], filterCompleter(@completer, ["his", "tory"]) @@ -194,15 +194,15 @@ context "domain completer (removing entries)",    should "remove 1 entry for domain with reference count of 1", ->      @onVisitRemovedListener { allHistory: false, urls: [@history1.url] } -    assert.equal "history2.com", filterCompleter(@completer, ["story"])[0].url +    assert.equal "http://history2.com", filterCompleter(@completer, ["story"])[0].url      assert.equal 0, filterCompleter(@completer, ["story1"]).length    should "remove 2 entries for domain with reference count of 2", ->      @onVisitRemovedListener { allHistory: false, urls: [@history2.url] } -    assert.equal "history2.com", filterCompleter(@completer, ["story2"])[0].url +    assert.equal "http://history2.com", filterCompleter(@completer, ["story2"])[0].url      @onVisitRemovedListener { allHistory: false, urls: [@history3.url] }      assert.equal 0, filterCompleter(@completer, ["story2"]).length -    assert.equal "history1.com", filterCompleter(@completer, ["story"])[0].url +    assert.equal "http://history1.com", filterCompleter(@completer, ["story"])[0].url    should "remove 3 (all) matching domain entries", ->      @onVisitRemovedListener { allHistory: false, urls: [@history2.url] } diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee index b2d656ab..556f5b7a 100644 --- a/tests/unit_tests/utils_test.coffee +++ b/tests/unit_tests/utils_test.coffee @@ -61,6 +61,13 @@ context "hasChromePrefix",      assert.isFalse Utils.hasChromePrefix "data"      assert.isFalse Utils.hasChromePrefix "data :foobar" +context "isUrl", +  should "identify URLs as URLs", -> +    assert.isTrue Utils.isUrl "http://www.example.com/blah" + +  should "identify non-URLs and non-URLs", -> +    assert.isFalse Utils.isUrl "http://www.example.com/ blah" +  context "Function currying",    should "Curry correctly", ->      foo = (a, b) -> "#{a},#{b}"  | 
