clean up some tests

Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2025-03-12 18:52:51 -07:00
parent 532d77f372
commit a829074b99
No known key found for this signature in database

View file

@ -5,8 +5,9 @@
(:require (:require
[clojure.core.reducers :as r] [clojure.core.reducers :as r]
[clojure.string :as str] [clojure.string :as str]
[lazytest.core :refer [around]] [lazytest.core :refer [around ok?]]
[lazytest.experimental.interfaces.clojure-test :refer [deftest is testing thrown?]] [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing
thrown?]]
[next.jdbc :as jdbc] [next.jdbc :as jdbc]
[next.jdbc.connection :as c] [next.jdbc.connection :as c]
[next.jdbc.prepare :as prep] [next.jdbc.prepare :as prep]
@ -26,16 +27,17 @@
(specs/instrument) (specs/instrument)
(deftest spec-tests (defdescribe spec-tests
"sanity checks on instrumented function calls"
{:context [(around [f] (with-test-db f))]} {:context [(around [f] (with-test-db f))]}
(let [db-spec {:dbtype "h2:mem" :dbname "clojure_test"}] (let [db-spec {:dbtype "h2:mem" :dbname "clojure_test"}]
;; some sanity checks on instrumented function calls: (it "succeeds with a basic db-spec"
(jdbc/get-datasource db-spec) (ok? #(jdbc/get-datasource db-spec))
(jdbc/get-connection db-spec) (ok? #(jdbc/get-connection db-spec)))
;; and again with options:
(let [db-spec' (jdbc/with-options db-spec {})] (let [db-spec' (jdbc/with-options db-spec {})]
(jdbc/get-datasource db-spec') (it "succeeds with an option-wrapped db-spec"
(jdbc/get-connection db-spec')))) (ok? #(jdbc/get-datasource db-spec'))
(ok? #(jdbc/get-connection db-spec'))))))
(deftest basic-tests (deftest basic-tests
{:context [(around [f] (with-test-db f))]} {:context [(around [f] (with-test-db f))]}