mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 18:06:32 +00:00
fix: graph-parser tests
This commit is contained in:
@@ -24,21 +24,21 @@
|
||||
(not= (:uuid x) (:block/uuid result))
|
||||
(= (select-keys result
|
||||
[:block/properties :block/title :block/properties-text-values :block/properties-order]) (gp-block/block-keywordize y))))
|
||||
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :content "bar\nid:: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
|
||||
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :title "bar\nid:: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
|
||||
{:properties {},
|
||||
:content "bar",
|
||||
:title "bar",
|
||||
:properties-text-values {},
|
||||
:properties-order []}
|
||||
|
||||
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :org, :meta {:start_pos 51, :end_pos 101}, :macros [], :content "bar\n:id: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
|
||||
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :org, :meta {:start_pos 51, :end_pos 101}, :macros [], :title "bar\n:id: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
|
||||
{:properties {},
|
||||
:content "bar",
|
||||
:title "bar",
|
||||
:properties-text-values {},
|
||||
:properties-order []}
|
||||
|
||||
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :content "bar\n \n id:: 63f199bc-c737-459f-983d-84acfcda14fe\nblock body", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
|
||||
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :title "bar\n \n id:: 63f199bc-c737-459f-983d-84acfcda14fe\nblock body", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
|
||||
{:properties {},
|
||||
:content "bar\nblock body",
|
||||
:title "bar\nblock body",
|
||||
:properties-text-values {},
|
||||
:properties-order []}))
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
(docs-graph-helper/docs-graph-assertions @conn graph-dir files)
|
||||
|
||||
(testing "Additional counts"
|
||||
(is (= 58051 (count (d/datoms @conn :eavt))) "Correct datoms count"))
|
||||
(is (= 58054 (count (d/datoms @conn :eavt))) "Correct datoms count"))
|
||||
|
||||
(testing "Asts"
|
||||
(is (seq asts) "Asts returned are non-zero")
|
||||
@@ -28,4 +28,4 @@
|
||||
;; could also used common-config but API isn't public yet
|
||||
(string/includes? (:file %) (str graph-dir "/logseq/")))
|
||||
asts))
|
||||
"Parsed files shouldn't have empty asts"))))
|
||||
"Parsed files shouldn't have empty asts"))))
|
||||
|
||||
@@ -122,14 +122,16 @@
|
||||
[db query-ent]
|
||||
(->> (db-property/properties query-ent)
|
||||
(map (fn [[k v]]
|
||||
[k
|
||||
(if-let [built-in-type (get-in db-property/built-in-properties [k :schema :type])]
|
||||
(if (= :block/tags k)
|
||||
(mapv #(:db/ident (d/entity db (:db/id %))) v)
|
||||
(if (db-property-type/ref-property-types built-in-type)
|
||||
(db-property/ref->property-value-contents db v)
|
||||
v))
|
||||
(db-property/ref->property-value-contents db v))]))
|
||||
(if (boolean? v)
|
||||
[k v]
|
||||
[k
|
||||
(if-let [built-in-type (get-in db-property/built-in-properties [k :schema :type])]
|
||||
(if (= :block/tags k)
|
||||
(mapv #(:db/ident (d/entity db (:db/id %))) v)
|
||||
(if (db-property-type/ref-property-types built-in-type)
|
||||
(db-property/ref->property-value-contents db v)
|
||||
v))
|
||||
(db-property/ref->property-value-contents db v))])))
|
||||
(into {})))
|
||||
|
||||
;; Tests
|
||||
@@ -224,7 +226,7 @@
|
||||
:user.property/prop-num 5
|
||||
:user.property/prop-string "woot"}
|
||||
(update-vals (db-property/properties (find-block-by-content @conn "b1"))
|
||||
#(db-property/ref->property-value-content @conn %)))
|
||||
(fn [v] (if (map? v) (db-property/ref->property-value-content @conn v) v))))
|
||||
"Basic block has correct properties")
|
||||
(is (= #{"prop-num" "prop-string" "prop-bool"}
|
||||
(->> (d/entity @conn (:db/id (find-block-by-content @conn "b1")))
|
||||
|
||||
Reference in New Issue
Block a user