diff options
Diffstat (limited to 'tests/unit_tests')
| -rw-r--r-- | tests/unit_tests/completion_test.coffee | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index f3ed4e61..32b62a28 100644 --- a/tests/unit_tests/completion_test.coffee +++ b/tests/unit_tests/completion_test.coffee @@ -154,8 +154,25 @@ 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 + + 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) -> |
