aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit_tests/completion_test.coffee
diff options
context:
space:
mode:
authorStephen Blott2012-11-03 10:31:23 +0000
committerStephen Blott2012-11-03 10:31:23 +0000
commit2b1e7b1208bbd9c8e4dc0635163c810cc0c46316 (patch)
tree85707fe09ab7068bfe73a75228aba7b0db1613fc /tests/unit_tests/completion_test.coffee
parent61adf1857993e48c791b65484c1d2ed494554446 (diff)
downloadvimium-2b1e7b1208bbd9c8e4dc0635163c810cc0c46316.tar.bz2
Extend unit tests for RankingUtils.
1. Add additional tests for `RankingUtils.matches()`. 2. Add tests for `RankingUtils.wordRelevancy()`.
Diffstat (limited to 'tests/unit_tests/completion_test.coffee')
-rw-r--r--tests/unit_tests/completion_test.coffee13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee
index d3369398..f409aa6e 100644
--- a/tests/unit_tests/completion_test.coffee
+++ b/tests/unit_tests/completion_test.coffee
@@ -153,8 +153,19 @@ context "suggestions",
context "RankingUtils",
should "do a case insensitive match", ->
- assert.isTrue RankingUtils.matches(["maRiO"], "MARIO", "MARIo")
+ assert.isTrue RankingUtils.matches(["aRi"], "MARIO", "MARio")
+ should "do a case insensitive match on full term", ->
+ assert.isTrue RankingUtils.matches(["MaRiO"], "MARIO", "MARio")
+
+ should "do a case insensitive match on more than just two terms", ->
+ assert.isTrue RankingUtils.matches(["aRi"], "DOES_NOT_MATCH", "DOES_NOT_MATCH_EITHER", "MARio")
+
+ should "do case insensitive word relevancy (matching)", ->
+ assert.isTrue RankingUtils.wordRelevancy(["aRi"], "MARIO", "MARio") > 0.0
+
+ should "do case insensitive word relevancy (not matching)", ->
+ assert.isTrue RankingUtils.wordRelevancy(["DOES_NOT_MATCH"], "MARIO", "MARio") == 0.0
# A convenience wrapper around completer.filter() so it can be called synchronously in tests.
filterCompleter = (completer, queryTerms) ->