Browse Source

fix: other unit test

Tienson Qin 2 years ago
parent
commit
6f8b9712d9

+ 5 - 12
deps/graph-parser/src/logseq/graph_parser/block.cljs

@@ -367,18 +367,11 @@
                           (map
                            (fn [item]
                              (let [macro? (and (map? item)
-                                               (= "macro" (:type item)))
-                                   item-name (if macro? (str "macro." (:name item) " " (string/join " " (:arguments item))) item)
-                                   ref-page (cond-> (page-name->map item-name with-id? db true date-formatter)
-                                              tag?
-                                              (assoc :block/type "class")
-
-                                              ;; FIXME: property key should be UUID for db graphs
-                                              macro?
-                                              (assoc :block/type "macro"
-                                                     :block/properties {:logseq.macro-name (:name item)
-                                                                        :logseq.macro-arguments (:arguments item)}))]
-                               ref-page)) col)))]
+                                               (= "macro" (:type item)))]
+                               (when-not macro?
+                                 (cond-> (page-name->map item with-id? db true date-formatter)
+                                   tag?
+                                   (assoc :block/type "class"))))) col)))]
       (assoc block
              :refs (ref->map-fn *refs false)
              :tags (ref->map-fn *structured-tags true)))))

+ 13 - 8
deps/graph-parser/src/logseq/graph_parser/test/docs_graph_helper.cljs

@@ -130,13 +130,18 @@
                 (into {})))
         "Counts for blocks with common block attributes")
 
-    (is (= #{"term" "setting" "book" "templates" "Query table" "page"
-             "Whiteboard" "Whiteboard/Tool" "Whiteboard/Tool/Shape" "Whiteboard/Object"
-             "Whiteboard/Property" "Community" "Tweet"}
-           (->> (d/q '[:find (pull ?n [*]) :where [?b :block/namespace ?n]] db)
-                (map (comp :block/original-name first))
-                set))
-        "Has correct namespaces")
+    (let [no-name (->> (d/q '[:find (pull ?n [*]) :where [?b :block/namespace ?n]] db)
+                       (filter (fn [x]
+                                 (when-not (:block/original-name (first x))
+                                   x))))
+          all-namespaces (->> (d/q '[:find (pull ?n [*]) :where [?b :block/namespace ?n]] db)
+                              (map (comp :block/original-name first))
+                              set)]
+      (is (= #{"term" "setting" "book" "templates" "Query table" "page"
+               "Whiteboard" "Whiteboard/Tool" "Whiteboard/Tool/Shape" "Whiteboard/Object"
+               "Whiteboard/Property" "Community" "Tweet"}
+             all-namespaces)
+          (str "Has correct namespaces: " no-name)))
 
     (is (empty? (->> (d/q '[:find ?n :where [?b :block/name ?n]] db)
                      (map first)
@@ -153,7 +158,7 @@
   ;; only increase over time as the docs graph rarely has deletions
   (testing "Counts"
     (is (= 303 (count files)) "Correct file count")
-    (is (= 63632 (count (d/datoms db :eavt))) "Correct datoms count")
+    (is (= 63731 (count (d/datoms db :eavt))) "Correct datoms count")
 
     (is (= 5866
            (ffirst

+ 1 - 1
src/test/frontend/handler/repo_conversion_test.cljs

@@ -98,7 +98,7 @@
   ;; only increase over time as the docs graph rarely has deletions
   (testing "Counts"
     (is (= 211 (count files)) "Correct file count")
-    (is (= 38704 (count (d/datoms db :eavt))) "Correct datoms count")
+    (is (= 38819 (count (d/datoms db :eavt))) "Correct datoms count")
 
     (is (= 3600
            (ffirst