fix: tests with outdated :block/type assertions

also fix lint
feat/asset-sync
Gabriel Horner 2024-07-08 09:51:29 -04:00
parent b20b45719b
commit f7b753758c
6 changed files with 11 additions and 11 deletions

View File

@ -14,13 +14,13 @@
[{:page {:block/original-name "page1"}
:blocks [{:block/content "Jrue Holiday" :build/tags [:Person]}]}
{:page {:block/original-name "Jayson Tatum" :build/tags [:Person]}}])]
(is (= {:block/tags [{:block/original-name "Person", :block/type ["class"]}]}
(is (= {:block/tags [{:block/original-name "Person", :block/type ["class" "page"]}]}
(first (d/q '[:find [(pull ?b [{:block/tags [:block/original-name :block/type]}]) ...]
:where [?b :block/content "Jrue Holiday"]]
@conn)))
"Person class is created and correctly associated to a block")
(is (= {:block/tags [{:block/original-name "Person", :block/type ["class"]}]}
(is (= {:block/tags [{:block/original-name "Person", :block/type ["class" "page"]}]}
(first (d/q '[:find [(pull ?b [{:block/tags [:block/original-name :block/type]}]) ...]
:where [?b :block/original-name "Jayson Tatum"]]
@conn)))

View File

@ -32,7 +32,7 @@
(docs-graph-helper/docs-graph-assertions @conn graph-dir files)
(testing "Additional counts"
(is (= 47996 (count (d/datoms @conn :eavt))) "Correct datoms count"))
(is (= 48766 (count (d/datoms @conn :eavt))) "Correct datoms count"))
(testing "Asts"
(is (seq asts) "Asts returned are non-zero")
@ -150,7 +150,7 @@
(let [graph-dir "tmp/file-and-db-graph"
;; pages and their blocks which are being tested
pages-to-blocks
{{:block/name "page1"}
{{:block/name "page1" :block/type ["page"]}
[{:block/content "block 1"} {:block/content "block 2"}]
{:block/name "jul 20th, 2023" :block/type #{"journal"} :block/journal-day 20230720}
[{:block/content "b1"} {:block/content "b2"}]}

View File

@ -144,7 +144,8 @@
(is (= 9 (count (d/q '[:find ?b :where [?b :block/type "journal"]] @conn))))
;; Count includes Contents and page references
(is (= 9
(count (d/q '[:find (pull ?b [*]) :where [?b :block/original-name ?name] (not [?b :block/type])] @conn))))
(count (->> (d/q '[:find [(pull ?b [:block/original-name :block/type]) ...] :where [?b :block/original-name]] @conn)
(filter #(= ["page"] (:block/type %)))))))
(is (= 1 (count @assets))))
(testing "logseq files"
@ -242,7 +243,7 @@
"tagged block tag converts tag to page ref")
(is (= [(:db/id tag-page)] (map :db/id (:block/refs block)))
"tagged block has correct refs")
(is (and tag-page (not (:block/type tag-page)))
(is (and tag-page (not (contains? (set (:block/type tag-page)) "class")))
"tag page is not a class")
(is (= {:logseq.property/page-tags #{"Movie"}}
@ -263,7 +264,7 @@
(is (= ["class"] (:block/type tag-page))
"configured tag page in :tag-classes is a class")
(is (and another-tag-page (not (:block/type another-tag-page)))
(is (and another-tag-page (not (contains? (set (:block/type another-tag-page)) "class")))
"unconfigured tag page is not a class")
(is (= {:block/tags [:user.class/Movie]}
@ -280,7 +281,7 @@
tag-page (find-page-by-name @conn "Movie")]
(is (= (:block/content block) "The Creator")
"tagged block with configured tag strips tag from content")
(is (= ["class"] (:block/type tag-page))
(is (= ["class" "page"] (:block/type tag-page))
"configured tag page derived from :property-classes is a class")
(is (nil? (find-page-by-name @conn "type"))
"No page exists for configured property")

View File

@ -143,6 +143,6 @@
page (first pages)]
(is (= (get-in page [:block/file :file/path]) "/whiteboards/foo.edn"))
(is (= (:block/name page) "foo"))
(is (= (:block/type page) "whiteboard"))
(is (= (:block/type page) #{"whiteboard" "page"}))
(is (= (:block/original-name page) "Foo"))
(is (every? #(= (:block/parent %) [:block/uuid #uuid "a846e3b4-c41d-4251-80e1-be6978c36d8c"]) blocks))))

View File

@ -95,7 +95,7 @@
parent (:block/page (ffirst blocks))]
(is (= {:block/name "foo"
:block/original-name "Foo"
:block/type ["whiteboard"]
:block/type ["page" "whiteboard"]
:block/file {:file/path "/whiteboards/foo.edn"}}
parent)
"parsed block in the whiteboard page has correct parent page"))))

View File

@ -43,7 +43,6 @@
[logseq.graph-parser.mldoc :as gp-mldoc]
[logseq.common.util :as common-util]
[logseq.common.util.page-ref :as page-ref]
[medley.core :as medley]
[promesa.core :as p]
[reitit.frontend.easy :as rfe]
[rum.core :as rum]