mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 03:16:37 +00:00
Fix page-properties bug and dsl-query bug
parser test caught page properties bug and dsl-query tests once written correctly exposed another bug. Also remove unit test as they are replaced by integration style tests in graph-parser-test
This commit is contained in:
@@ -47,6 +47,21 @@
|
||||
|
||||
(defn- block-property-queries-test
|
||||
[]
|
||||
(load-test-files [{:file/path "journals/2022_02_28.md"
|
||||
:file/content "a:: b
|
||||
- b1
|
||||
prop-a:: val-a
|
||||
prop-num:: 2000
|
||||
- b2
|
||||
prop-a:: val-a
|
||||
prop-b:: val-b
|
||||
- b3
|
||||
prop-c:: [[page a]], [[page b]], [[page c]]
|
||||
prop-linked-num:: [[3000]]
|
||||
prop-d:: [[no-space-link]]
|
||||
- b4
|
||||
prop-d:: nada"}])
|
||||
|
||||
(testing "Blocks have given property value"
|
||||
(is (= #{"b1" "b2"}
|
||||
(set (map (comp first str/split-lines :block/content)
|
||||
@@ -99,30 +114,27 @@
|
||||
"Blocks that have a property"))
|
||||
|
||||
(deftest block-property-queries
|
||||
(load-test-files [{:file/path "journals/2022_02_28.md"
|
||||
:file/content "a:: b
|
||||
- b1
|
||||
prop-a:: val-a
|
||||
prop-num:: 2000
|
||||
- b2
|
||||
prop-a:: val-a
|
||||
prop-b:: val-b
|
||||
- b3
|
||||
prop-c:: [[page a]], [[page b]], [[page c]]
|
||||
prop-linked-num:: [[3000]]
|
||||
prop-d:: [[no-space-link]]
|
||||
- b4
|
||||
prop-d:: nada"}])
|
||||
|
||||
(testing "block property tests with default config"
|
||||
(test-helper/with-config {}
|
||||
(block-property-queries-test)))
|
||||
|
||||
(test-helper/start-test-db!) ;; reset db
|
||||
|
||||
(testing "block property tests with property-values-allow-links-and-text? config"
|
||||
(test-helper/with-config {:property-values-allow-links-and-text? true}
|
||||
(block-property-queries-test))))
|
||||
|
||||
(defn- page-property-queries-test
|
||||
[]
|
||||
(load-test-files [{:file/path "pages/page1.md"
|
||||
:file/content "parent:: [[child page 1]], [[child-no-space]]\ninteresting:: true"}
|
||||
{:file/path "pages/page2.md"
|
||||
:file/content "foo:: #bar\ninteresting:: false"}
|
||||
{:file/path "pages/page3.md"
|
||||
:file/content "parent:: [[child page 1]], [[child page 2]]\nfoo:: bar\ninteresting:: false"}
|
||||
{:file/path "pages/page4.md"
|
||||
:file/content "parent:: [[child page 2]]\nfoo:: baz"}])
|
||||
|
||||
(is (= ["page1" "page3" "page4"]
|
||||
(map :block/name (dsl-query "(page-property parent)")))
|
||||
"Pages have given property")
|
||||
@@ -173,18 +185,12 @@ prop-d:: nada"}])
|
||||
"Boolean false")))
|
||||
|
||||
(deftest page-property-queries
|
||||
(load-test-files [{:file/path "pages/page1.md"
|
||||
:file/content "parent:: [[child page 1]], [[child-no-space]]\ninteresting:: true"}
|
||||
{:file/path "pages/page2.md"
|
||||
:file/content "foo:: #bar\ninteresting:: false"}
|
||||
{:file/path "pages/page3.md"
|
||||
:file/content "parent:: [[child page 1]], [[child page 2]]\nfoo:: bar\ninteresting:: false"}
|
||||
{:file/path "pages/page4.md"
|
||||
:file/content "parent:: [[child page 2]]\nfoo:: baz"}])
|
||||
|
||||
(testing "page property tests with default config"
|
||||
(test-helper/with-config {}
|
||||
(page-property-queries-test)))
|
||||
|
||||
(test-helper/start-test-db!) ;; reset db
|
||||
|
||||
(testing "page property tests with property-values-allow-links-and-text? config"
|
||||
(test-helper/with-config {:property-values-allow-links-and-text? true}
|
||||
(page-property-queries-test))))
|
||||
|
||||
Reference in New Issue
Block a user