aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/completion_test.coffee8
-rw-r--r--tests/unit_tests/settings_test.coffee2
-rw-r--r--tests/unit_tests/test_chrome_stubs.coffee2
3 files changed, 9 insertions, 3 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee
index b7b73cc2..56fcc456 100644
--- a/tests/unit_tests/completion_test.coffee
+++ b/tests/unit_tests/completion_test.coffee
@@ -152,8 +152,9 @@ context "domain completer",
setup ->
@history1 = { title: "history1", url: "http://history1.com", lastVisitTime: hours(1) }
@history2 = { title: "history2", url: "http://history2.com", lastVisitTime: hours(1) }
+ @undef = { title: "history2", url: "http://undefined.net", lastVisitTime: hours(1) }
- stub(HistoryCache, "use", (onComplete) => onComplete([@history1, @history2]))
+ stub(HistoryCache, "use", (onComplete) => onComplete([@history1, @history2, @undef]))
global.chrome.history =
onVisited: { addListener: -> }
onVisitRemoved: { addListener: -> }
@@ -174,6 +175,9 @@ context "domain completer",
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"])
+ should "not return any results for empty queries", ->
+ assert.arrayEqual [], filterCompleter(@completer, [])
+
context "domain completer (removing entries)",
setup ->
@history1 = { title: "history1", url: "http://history1.com", lastVisitTime: hours(2) }
@@ -238,7 +242,7 @@ context "search engines",
@completer = new SearchEngineCompleter()
# note, I couldn't just call @completer.refresh() here as I couldn't set root.Settings without errors
# workaround is below, would be good for someone that understands the testing system better than me to improve
- @completer.searchEngines = Settings.getSearchEngines()
+ @completer.searchEngines = SearchEngineCompleter.getSearchEngines()
should "return search engine suggestion without description", ->
results = filterCompleter(@completer, ["foo", "hello"])
diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee
index afe862a4..346c98da 100644
--- a/tests/unit_tests/settings_test.coffee
+++ b/tests/unit_tests/settings_test.coffee
@@ -73,7 +73,7 @@ context "settings",
should "set search engines, retrieve them correctly and check that they have been parsed correctly", ->
searchEngines = "foo: bar?q=%s\n# comment\nbaz: qux?q=%s baz description"
Settings.set 'searchEngines', searchEngines
- result = Settings.getSearchEngines()
+ result = SearchEngineCompleter.getSearchEngines()
assert.equal Object.keys(result).length, 2
assert.equal "bar?q=%s", result["foo"].url
assert.isFalse result["foo"].description
diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee
index c61d7246..bc50521a 100644
--- a/tests/unit_tests/test_chrome_stubs.coffee
+++ b/tests/unit_tests/test_chrome_stubs.coffee
@@ -16,6 +16,8 @@ exports.chrome =
addListener: () -> true
onMessage:
addListener: () -> true
+ onInstalled:
+ addListener: ->
tabs:
onSelectionChanged: