mirror of
https://github.com/logseq/logseq.git
synced 2026-04-27 23:54:55 +00:00
fix: db import failing on namespace pages with built-in name
e.g. term/alias in docs graph. Also added some basic namespace import tests. Part of logseq/db-test#136 and part of LOG-3230
This commit is contained in:
@@ -329,6 +329,23 @@
|
||||
(:block/title (find-block-by-content @conn #"tasks with")))
|
||||
"Advanced query has custom title migrated"))
|
||||
|
||||
(testing "namespaces"
|
||||
(let [expand-children (fn expand-children [ent parent]
|
||||
(if-let [children (:logseq.property/_parent ent)]
|
||||
(cons {:parent (:block/title parent) :child (:block/title ent)}
|
||||
(mapcat #(expand-children % ent) children))
|
||||
[{:parent (:block/title parent) :child (:block/title ent)}]))]
|
||||
(is (= [{:parent "n1" :child "x"}
|
||||
{:parent "x" :child "z"}
|
||||
{:parent "x" :child "y"}]
|
||||
(rest (expand-children (d/entity @conn (:db/id (find-page-by-name @conn "n1"))) nil)))
|
||||
"First namespace tests duplicate parent page name")
|
||||
(is (= [{:parent "n2" :child "x"}
|
||||
{:parent "x" :child "z"}
|
||||
{:parent "n2" :child "alias"}]
|
||||
(rest (expand-children (d/entity @conn (:db/id (find-page-by-name @conn "n2"))) nil)))
|
||||
"First namespace tests duplicate child page name and built-in page name")))
|
||||
|
||||
(testing "db attributes"
|
||||
(is (= true
|
||||
(:block/collapsed? (find-block-by-content @conn "collapsed block")))
|
||||
|
||||
Reference in New Issue
Block a user