Browse Source

fix: db graph cljs tests need repeatable idents

Also remove unused ldb fn
Gabriel Horner 8 months ago
parent
commit
a0ee41ca86

+ 0 - 1
deps/db/src/logseq/db.cljs

@@ -505,7 +505,6 @@
                e))))))
 
 (def built-in? entity-util/built-in?)
-(def get-classes-with-property db-db/get-classes-with-property)
 (def built-in-class-property? db-db/built-in-class-property?)
 (def private-built-in-page? db-db/private-built-in-page?)
 

+ 0 - 5
deps/db/src/logseq/db/frontend/db.cljs

@@ -9,11 +9,6 @@
             [logseq.db.frontend.entity-util :as entity-util]
             [logseq.db.frontend.property :as db-property]))
 
-(defn get-classes-with-property
-  "Get classes which have given property as a class property"
-  [db property-id]
-  (:logseq.property.class/_properties (d/entity db property-id)))
-
 (defn built-in-class-property?
   "Whether property a built-in property for the specific class"
   [class-entity property-entity]

+ 1 - 1
deps/db/src/logseq/db/frontend/db_ident.cljc

@@ -68,7 +68,7 @@
   (assert (not (re-find #"^(logseq|block)(\.|$)" (name user-namespace)))
           "New ident is not allowed to use an internal namespace")
   (if #?(:org.babashka/nbb true
-         :cljs js/process.env.REPEATABLE_IDENTS
+         :cljs (or js/process.env.REPEATABLE_IDENTS js/process.env.DB_GRAPH)
          :default false)
     ;; Used for contexts where we want repeatable idents e.g. tests and CLIs
     (keyword user-namespace (-> name-string (string/replace #"[/()]|\s+" "-") (string/replace-first #"^(\d)" "NUM-$1")))

+ 1 - 11
deps/db/test/logseq/db_test.cljs

@@ -82,14 +82,4 @@
         "Class pages correctly found for given class")
     (is (= nil
            (ldb/page-exists? @conn "movie" #{:logseq.class/Property}))
-        "Class pages correctly not found for given class")))
-
-(deftest get-classes-with-property-test
-  (let [conn (db-test/create-conn-with-blocks
-              {:properties {:prop1 {:logseq.property/type :default}}
-               :classes
-               {:Class1 {:build/class-properties [:prop1]}
-                :Class2 {:build/class-properties [:prop1]}}})
-        classes (ldb/get-classes-with-property @conn :user.property/prop1)]
-    (is (= ["Class1" "Class2"]
-           (map :block/title classes)))))
+        "Class pages correctly not found for given class")))

+ 0 - 5
src/main/frontend/db/model.cljs

@@ -445,11 +445,6 @@ independent of format as format specific heading characters are stripped"
   [page-name]
   (ldb/journal? (ldb/get-page (conn/get-db) page-name)))
 
-(defn get-classes-with-property
-  "Get classes which have given property as a class property"
-  [property-id]
-  (ldb/get-classes-with-property (conn/get-db) property-id))
-
 (defn get-all-referenced-blocks-uuid
   "Get all uuids of blocks with any back link exists."
   []