From b0e187931cf0d1272aa7a18ea462451042b31132 Mon Sep 17 00:00:00 2001 From: Linus Lee Date: Thu, 21 Jul 2022 10:45:03 -0400 Subject: [PATCH] fix: Allow query string to contain weird whitespace --- test/search.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/search.js b/test/search.js index 0f229a1..223bc85 100644 --- a/test/search.js +++ b/test/search.js @@ -52,6 +52,12 @@ describe('basic search', () => { ]); }); + it('search query may contain newlines, tabs, and multiple consecutive spaces', () => { + assert.deepEqual(search(ITEMS, ' linus\t is\nperson\t', x => x.name), [ + item('linus is a person'), + ]); + }); + it('correctly implements TF-IDF ranking', () => { //> In this example, "mango" has much higher IDF (is a higher-signal // word) in the corpus than "apple", which appears in nearly every