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:
Gabriel Horner
2026-01-06 15:23:03 -05:00
parent e5778093a6
commit e01664bac4
7 changed files with 80 additions and 134 deletions

View File

@@ -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")))}))))