|
|
@@ -0,0 +1,29 @@
|
|
|
+(ns logseq.graph-parser-test
|
|
|
+ (:require [cljs.test :refer [deftest testing is]]
|
|
|
+ [logseq.graph-parser :as graph-parser]
|
|
|
+ [logseq.graph-parser.db :as gp-db]
|
|
|
+ [datascript.core :as d]))
|
|
|
+
|
|
|
+(deftest parse-file
|
|
|
+ (testing "id properties"
|
|
|
+ (let [conn (gp-db/start-conn)]
|
|
|
+ (graph-parser/parse-file conn "foo.md" "- id:: 628953c1-8d75-49fe-a648-f4c612109098" {})
|
|
|
+ (is (= [{:id "628953c1-8d75-49fe-a648-f4c612109098"}]
|
|
|
+ (->> (d/q '[:find (pull ?b [*])
|
|
|
+ :in $
|
|
|
+ :where [?b :block/content] [(missing? $ ?b :block/name)]]
|
|
|
+ @conn)
|
|
|
+ (map first)
|
|
|
+ (map :block/properties)))
|
|
|
+ "id as text has correct :block/properties"))
|
|
|
+
|
|
|
+ (let [conn (gp-db/start-conn)]
|
|
|
+ (graph-parser/parse-file conn "foo.md" "- id:: [[628953c1-8d75-49fe-a648-f4c612109098]]" {})
|
|
|
+ (is (= [{:id #{"628953c1-8d75-49fe-a648-f4c612109098"}}]
|
|
|
+ (->> (d/q '[:find (pull ?b [*])
|
|
|
+ :in $
|
|
|
+ :where [?b :block/content] [(missing? $ ?b :block/name)]]
|
|
|
+ @conn)
|
|
|
+ (map first)
|
|
|
+ (map :block/properties)))
|
|
|
+ "id as linked ref has correct :block/properties"))))
|