fix: tests

pull/6850/head
Peng Xiao 2022-09-29 00:21:49 +08:00
parent 562417baf3
commit d1a7846a3b
2 changed files with 7 additions and 5 deletions

View File

@ -74,13 +74,14 @@
:block/format :markdown}), :block/format :markdown}),
:pages :pages
({:block/format :markdown, ({:block/format :markdown,
:block/original-name "Foo"
:block/properties {:title "my whiteboard foo"}})}) :block/properties {:title "my whiteboard foo"}})})
(deftest test-extract-whiteboard-edn (deftest test-extract-whiteboard-edn
[] []
(let [{:keys [pages blocks]} (extract/extract-whiteboard-edn "/whiteboards/Foo.edn" (pr-str foo-edn) {}) (let [{:keys [pages blocks]} (extract/extract-whiteboard-edn "/whiteboards/foo.edn" (pr-str foo-edn) {})
page (first pages)] page (first pages)]
(is (= (get-in page [:block/file :file/path]) "/whiteboards/Foo.edn")) (is (= (get-in page [:block/file :file/path]) "/whiteboards/foo.edn"))
(is (= (:block/name page) "foo")) (is (= (:block/name page) "foo"))
(is (= (:block/type page) "whiteboard")) (is (= (:block/type page) "whiteboard"))
(is (= (:block/original-name page) "Foo")) (is (= (:block/original-name page) "Foo"))

View File

@ -17,6 +17,7 @@
:block/format :markdown}), :block/format :markdown}),
:pages :pages
({:block/format :markdown, ({:block/format :markdown,
:block/original-name "Foo"
:block/properties {:title "my whiteboard foo"}})}) :block/properties {:title "my whiteboard foo"}})})
(deftest parse-file (deftest parse-file
@ -58,7 +59,7 @@
(testing "parsing whiteboard page" (testing "parsing whiteboard page"
(let [conn (ldb/start-conn)] (let [conn (ldb/start-conn)]
(graph-parser/parse-file conn "/whiteboards/Foo.edn" (pr-str foo-edn) {}) (graph-parser/parse-file conn "/whiteboards/foo.edn" (pr-str foo-edn) {})
(let [blocks (d/q '[:find (pull ?b [* {:block/page (let [blocks (d/q '[:find (pull ?b [* {:block/page
[:block/name [:block/name
:block/original-name :block/original-name
@ -69,10 +70,10 @@
:where [?b :block/content] [(missing? $ ?b :block/name)]] :where [?b :block/content] [(missing? $ ?b :block/name)]]
@conn) @conn)
parent (:block/page (ffirst blocks))] parent (:block/page (ffirst blocks))]
(is (= {:block/name "foo" (is (= {:block/name "foo"
:block/original-name "Foo" :block/original-name "Foo"
:block/type "whiteboard" :block/type "whiteboard"
:block/file {:file/path "/whiteboards/Foo.edn"}} :block/file {:file/path "/whiteboards/foo.edn"}}
parent) parent)
"parsed block in the whiteboard page has correct parent page"))))) "parsed block in the whiteboard page has correct parent page")))))