mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 03:16:37 +00:00
chore: convert more frontend tests to db graph
Removed file graph specific tests in outliner.core-test and export-test. Also fixed test for export-test as file graph exports didn't reference pages in blocks
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
(use-fixtures :each
|
||||
{:before (fn []
|
||||
(async done
|
||||
(test-helper/start-test-db!)
|
||||
(test-helper/start-test-db! {:db-graph? true})
|
||||
(done)))
|
||||
:after test-helper/destroy-test-db!})
|
||||
|
||||
@@ -45,18 +45,19 @@
|
||||
{:id block-dom-id
|
||||
:block-uuid (:block/uuid block)}]))]
|
||||
(p/do!
|
||||
(editor/delete-block! test-helper/test-db)
|
||||
(editor/delete-block! test-helper/test-db-name-db-version)
|
||||
(when (fn? on-delete)
|
||||
(on-delete))))))
|
||||
|
||||
(deftest-async delete-block-async!
|
||||
(testing "backspace deletes empty block"
|
||||
(load-test-files [{:file/path "pages/page1.md"
|
||||
:file/content "\n
|
||||
- b1
|
||||
- b2
|
||||
-"}])
|
||||
(p/let [conn (db/get-db test-helper/test-db false)
|
||||
(load-test-files
|
||||
[{:page {:block/title "page1"}
|
||||
:blocks
|
||||
[{:block/title "b1"}
|
||||
{:block/title "b2"}
|
||||
{:block/title ""}]}])
|
||||
(p/let [conn (db/get-db test-helper/test-db-name-db-version false)
|
||||
block (->> (d/q '[:find (pull ?b [*])
|
||||
:where [?b :block/title ""]
|
||||
[?p :block/name "page1"]
|
||||
@@ -69,7 +70,7 @@
|
||||
:where
|
||||
[?b :block/parent]
|
||||
[?b :block/title]
|
||||
[(missing? $ ?b :block/pre-block?)]]
|
||||
[(missing? $ ?b :logseq.property/built-in?)]]
|
||||
@conn)
|
||||
(map (comp :block/title first)))]
|
||||
(is (= ["b1" "b2"] updated-blocks) "Block is deleted")))})))
|
||||
@@ -77,12 +78,7 @@
|
||||
(testing "backspace deletes empty block in embedded context"
|
||||
;; testing embed at this layer doesn't require an embed block since
|
||||
;; delete-block handles all the embed setup
|
||||
(load-test-files [{:file/path "pages/page1.md"
|
||||
:file/content "\n
|
||||
- b1
|
||||
- b2
|
||||
-"}])
|
||||
(p/let [conn (db/get-db test-helper/test-db false)
|
||||
(p/let [conn (db/get-db test-helper/test-db-name-db-version false)
|
||||
block (->> (d/q '[:find (pull ?b [*])
|
||||
:where [?b :block/title ""]
|
||||
[?p :block/name "page1"]
|
||||
@@ -96,7 +92,7 @@
|
||||
:where
|
||||
[?b :block/parent]
|
||||
[?b :block/title]
|
||||
[(missing? $ ?b :block/pre-block?)]]
|
||||
[(missing? $ ?b :logseq.property/built-in?)]]
|
||||
@conn)
|
||||
(map (comp :block/title first)))]
|
||||
(is (= ["b1" "b2"] updated-blocks) "Block is deleted")))}))))
|
||||
|
||||
Reference in New Issue
Block a user