chore: replace uses of :string in tests and properties graph

Also removed test which tested an unused fn
This commit is contained in:
Gabriel Horner
2024-05-16 16:28:43 -04:00
parent 35e6ad120d
commit 0284816f22
4 changed files with 7 additions and 33 deletions

View File

@@ -22,22 +22,6 @@
(use-fixtures :each start-and-destroy-db)
(deftest get-block-property-values-test
(let [conn (db/get-db false)]
(outliner-property/upsert-property! conn :user.property/property-1 {:type :string} {:property-name "property 1"})
(outliner-property/set-block-property! conn fbid :user.property/property-1 "value 1")
(outliner-property/set-block-property! conn sbid :user.property/property-1 "value 2")
(is (= (model/get-block-property-values :user.property/property-1)
["value 1" "value 2"]))))
(deftest get-db-property-values-test
(let [conn (db/get-db false)]
(outliner-property/upsert-property! conn :user.property/property-1 {:type :number} {:property-name "property 1"})
(outliner-property/set-block-property! conn fbid :user.property/property-1 "1")
(outliner-property/set-block-property! conn sbid :user.property/property-1 "2")
(is (= ["1" "2"]
(map (fn [id] (:block/content (d/entity @conn id))) (model/get-block-property-values :user.property/property-1))))))
;; (deftest get-db-property-values-test-with-pages
;; (let [opts {:redirect? false :create-first-block? false}
;; _ (page-handler/create! "page1" opts)

View File

@@ -35,7 +35,7 @@
(deftest ^:large-vars/cleanup-todo block-property-test
(testing "Add a property to a block"
(let [conn (db/get-db false)]
(outliner-property/upsert-property! conn :user.property/property-1 {:type :string}
(outliner-property/upsert-property! conn :user.property/property-1 {:type :default}
{:property-name "property 1"})
(outliner-property/set-block-property! conn fbid :user.property/property-1 "value"))
(let [block (db/entity [:block/uuid fbid])
@@ -44,7 +44,7 @@
;; ensure property exists
(are [x y] (= x y)
(:block/schema property)
{:type :string}
{:type :default}
(:block/type property)
#{"property"})
;; check block's properties
@@ -53,7 +53,7 @@
1
(keyword? (ffirst properties))
true
(second (first properties))
(:block/content (second (first properties)))
"value")))
(testing "Add another property"
@@ -146,14 +146,14 @@
(let [k :user.property/property-4
v "batch value"
conn (db/get-db false)]
(outliner-property/upsert-property! conn :user.property/property-4 {:type :string} {})
(outliner-property/upsert-property! conn :user.property/property-4 {:type :default} {})
(outliner-property/batch-set-property! conn [fbid sbid] k v)
(let [fb (db/entity [:block/uuid fbid])
sb (db/entity [:block/uuid sbid])]
(are [x y] (= x y)
(get (:block/properties fb) k)
(:block/content (get (:block/properties fb) k))
v
(get (:block/properties sb) k)
(:block/content (get (:block/properties sb) k))
v))))
(testing "Batch remove properties"