|
|
@@ -200,3 +200,20 @@
|
|
|
result (#'search/search-blocks-aux (checking-db) sql "a/" "%a/%" "page-1" 10)]
|
|
|
(is (some? result))
|
|
|
(is (empty? result)))))
|
|
|
+
|
|
|
+(deftest fuse-constructor-interop
|
|
|
+ (testing "Fuse constructor remains usable for build/search/add/remove across export shapes"
|
|
|
+ (let [ctor search/fuse
|
|
|
+ indice (ctor. (clj->js [{:id "1" :title "alpha beta"}])
|
|
|
+ (clj->js {:keys ["title"]
|
|
|
+ :shouldSort true
|
|
|
+ :tokenize true
|
|
|
+ :distance 1024
|
|
|
+ :threshold 0.5
|
|
|
+ :minMatchCharLength 1}))]
|
|
|
+ (.add indice (clj->js {:id "2" :title "gamma"}))
|
|
|
+ (.remove indice (fn [page] (= "2" (aget page "id"))))
|
|
|
+ (let [result (js->clj (.search indice "alpha" (clj->js {:limit 5})) :keywordize-keys true)]
|
|
|
+ (is (some? ctor))
|
|
|
+ (is (= 1 (count result)))
|
|
|
+ (is (= "alpha beta" (get-in result [0 :item :title])))))))
|