Browse Source

chore: Add optional verbose test runner for db deps

Also adjust one test which made verbose mode unreadable by printing a
large data structure where an assertion should go
Gabriel Horner 7 months ago
parent
commit
0852dec984

+ 2 - 1
deps/db/nbb.edn

@@ -7,4 +7,5 @@
   logseq/clj-fractional-indexing        {:git/url "https://github.com/logseq/clj-fractional-indexing"
                                          :sha     "7182b7878410f78536dc2b6df35ed32ef9cd6b61"}
   io.github.nextjournal/nbb-test-runner
-  {:git/sha "60ed57aa04bca8d604f5ba6b28848bd887109347"}}}
+  {:git/sha "60ed57aa04bca8d604f5ba6b28848bd887109347"}
+  io.github.pez/baldr {:mvn/version "1.0.9"}}}

+ 2 - 1
deps/db/package.json

@@ -9,6 +9,7 @@
     "better-sqlite3": "9.3.0"
   },
   "scripts": {
-    "test": "yarn nbb-logseq -cp test -m nextjournal.test-runner"
+    "test": "yarn nbb-logseq -cp test -m nextjournal.test-runner",
+    "test-v": "yarn nbb-logseq -cp test -m logseq.db.test-runner"
   }
 }

+ 3 - 3
deps/db/test/logseq/db/sqlite/create_graph_test.cljs

@@ -163,9 +163,9 @@
                                        :block/order ;; TODO: block/order should be same as well
                                        ))
                      init-data*)))]
-      (let [[first-only second-only common]
+      (let [[first-only second-only _common]
             (data/diff (remove-ignored-attrs&entities (sqlite-create-graph/build-db-initial-data ""))
                        (remove-ignored-attrs&entities (sqlite-create-graph/build-db-initial-data "")))]
+        ;; (pr-str [first-only second-only _common])
         (is (and (every? nil? first-only)
-                 (every? nil? second-only))
-            (pr-str [first-only second-only common]))))))
+                 (every? nil? second-only)))))))

+ 6 - 0
deps/db/test/logseq/db/test_runner.cljs

@@ -0,0 +1,6 @@
+(ns logseq.db.test-runner
+  "Test runner which enables https://github.com/PEZ/baldr by default"
+  (:require [nextjournal.test-runner :as next-runner]
+            [pez.baldr]))
+
+(def -main next-runner/-main)