mirror of https://github.com/logseq/logseq
fix: unit test and keyword typo
parent
832061b2ac
commit
ae762ab944
|
@ -434,7 +434,7 @@
|
||||||
(:block/original-name e))
|
(:block/original-name e))
|
||||||
:value value})
|
:value value})
|
||||||
{:label value
|
{:label value
|
||||||
:vaue value})))
|
:value value})))
|
||||||
(distinct)))
|
(distinct)))
|
||||||
items (->> (if (= :date type)
|
items (->> (if (= :date type)
|
||||||
(map (fn [m] (let [label (:block/original-name (db/entity (:value m)))]
|
(map (fn [m] (let [label (:block/original-name (db/entity (:value m)))]
|
||||||
|
|
|
@ -301,20 +301,18 @@
|
||||||
(is (= result :value-exists))))
|
(is (= result :value-exists))))
|
||||||
|
|
||||||
(testing "Add new value"
|
(testing "Add new value"
|
||||||
(let [{:keys [block-id tx-data]} (outliner-property/upsert-closed-value! conn (:db/id property) {:value 3})]
|
(let [_ (outliner-property/upsert-closed-value! conn (:db/id property) {:value 3})]
|
||||||
(db/transact! tx-data)
|
(let [b (first (d/q '[:find [(pull ?b [*]) ...] :where [?b :block/content "3"]] @conn))]
|
||||||
(let [b (db/entity [:block/uuid block-id])]
|
(is (contains? (set (:block/type b)) "closed value"))
|
||||||
(is (= "3" (:block/content b)))
|
|
||||||
(is (contains? (:block/type b) "closed value"))
|
|
||||||
(let [values (get-value-ids k)]
|
(let [values (get-value-ids k)]
|
||||||
(is (= #{"1" "2" "3"}
|
(is (= #{"1" "2" "3"}
|
||||||
(get-closed-values values))))
|
(get-closed-values values))))
|
||||||
|
|
||||||
(testing "Update closed value"
|
(testing "Update closed value"
|
||||||
(let [{:keys [tx-data]} (outliner-property/upsert-closed-value! conn (:db/id property) {:id block-id
|
(let [block-id (:block/uuid b)
|
||||||
:value 4
|
_ (outliner-property/upsert-closed-value! conn (:db/id property) {:id block-id
|
||||||
:description "choice 4"})]
|
:value 4
|
||||||
(db/transact! tx-data)
|
:description "choice 4"})]
|
||||||
(let [b (db/entity [:block/uuid block-id])]
|
(let [b (db/entity [:block/uuid block-id])]
|
||||||
(is (= "4" (:block/content b)))
|
(is (= "4" (:block/content b)))
|
||||||
(is (= "choice 4" (:description (:block/schema b))))
|
(is (= "choice 4" (:description (:block/schema b))))
|
||||||
|
|
Loading…
Reference in New Issue