From aa083a7e985f7509d115d8a3f14f8a13314a4655 Mon Sep 17 00:00:00 2001 From: Utkarsh Upadhyay Date: Sun, 12 Apr 2015 17:19:57 +0200 Subject: Add failing test case. --- tests/unit_tests/completion_test.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index 685758c5..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) } -- cgit v1.2.3