Split out parse-property for use in dsl-query and tests

- Add tests for all *property dsl queries with and without new
  config option
- Add tests for property persistence
- Add tests for property relationships
This commit is contained in:
Gabriel Horner
2022-08-06 01:35:39 -04:00
parent 405183db09
commit 0719163d30
10 changed files with 234 additions and 51 deletions

View File

@@ -6,7 +6,6 @@
[clojure.set :as set]
[clojure.string :as string]
[clojure.walk :as walk]
[frontend.state :as state]
[frontend.date :as date]
[frontend.db.model :as model]
[frontend.db.query-react :as query-react]
@@ -240,7 +239,7 @@
(let [k (string/replace (name (nth e 1)) "_" "-")
v (nth e 2)
v (if-not (nil? v)
(text/parse-property k v (state/get-config))
(text/parse-property-value (str v))
v)
v (if (coll? v) (first v) v)]
{:query (list 'property '?b (keyword k) v)
@@ -285,7 +284,7 @@
(let [[k v] (rest e)
k (string/replace (name k) "_" "-")]
(if (some? v)
(let [v' (text/parse-property k v (state/get-config))
(let [v' (text/parse-property-value (str v))
val (if (coll? v') (first v') v')]
{:query (list 'page-property '?p (keyword k) val)
:rules [:page-property]})