Add test for feed-generator/make-filters, change vectorize to function

This commit is contained in:
felisp 2024-10-22 01:58:59 +02:00
parent fda332654e
commit b31417fecc
2 changed files with 17 additions and 6 deletions

View file

@ -47,10 +47,12 @@
~x
result#)))
(defmacro vectorize
"If arg is not a vector, put into vector, otherwise return it"
(defn vectorize
"If v isn't a vector, put it into one, otherwise return"
[v]
(if (vector? v) v [v]))
(if (vector? v)
v
[v]))
;; ===== Generic functions ====

View file

@ -1,6 +1,7 @@
(ns rss-thread-watch.feed-generator-test
(:require [clojure.test :refer :all]
[rss-thread-watch.feed-generator :refer :all]))
[rss-thread-watch.feed-generator :refer :all]
[rss-thread-watch.filters :as f]))
(def thread-list [{:title "Some thread title"
:chod 94.0
@ -26,9 +27,17 @@
(is (= (update-only-guid sin-thrd)
(assoc sin-thrd :guid "696942042-20-94.00"))))))
(def query-map1 {"Q" ["PONIes" "aRe" "CUTE"]
"q" ["/general/" "foo bar"]
"x" "Not really filter"
"board" ["/p/" "/mlp/"]})
(def query-map1-result {f/case-insensitive-filter ["/general/" "foo bar"]
f/case-sensitive-filter ["PONIes" "aRe" "CUTE"]})
(deftest filtering
(testing "Filter map making")
)
(testing "Filter map making"
(is (= query-map1-result (make-filters query-map1 f/known-filters)))))