aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorStephen Blott2012-11-03 10:57:36 +0000
committerStephen Blott2012-11-03 10:57:36 +0000
commitd9e0ba4f0a06b5f5543a4398434399497573336d (patch)
treec086ab70316b7e8ee64d6b154a0f4ffda519b061 /tests/unit_tests
parent2b1e7b1208bbd9c8e4dc0635163c810cc0c46316 (diff)
downloadvimium-d9e0ba4f0a06b5f5543a4398434399497573336d.tar.bz2
Bug fix. Not all query terms matched.
Additionally, add relevant test cases.
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/completion_test.coffee6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee
index f409aa6e..9cde460e 100644
--- a/tests/unit_tests/completion_test.coffee
+++ b/tests/unit_tests/completion_test.coffee
@@ -167,6 +167,12 @@ context "RankingUtils",
should "do case insensitive word relevancy (not matching)", ->
assert.isTrue RankingUtils.wordRelevancy(["DOES_NOT_MATCH"], "MARIO", "MARio") == 0.0
+ should "every term must match at least one thing (matching)", ->
+ assert.isTrue RankingUtils.matches(["cat", "dog"], "catapult", "hound dog")
+
+ should "every term must match at least one thing (not matching)", ->
+ assert.isTrue not RankingUtils.matches(["cat", "dog", "wolf"], "catapult", "hound dog")
+
# A convenience wrapper around completer.filter() so it can be called synchronously in tests.
filterCompleter = (completer, queryTerms) ->
results = []