diff --git a/deps.edn b/deps.edn index 9bba423..f4e43d5 100644 --- a/deps.edn +++ b/deps.edn @@ -19,10 +19,7 @@ ;; running tests/checks of various kinds: :test {:extra-paths ["test"] :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} - io.github.noahtheduke/lazytest - {:git/url "https://github.com/NoahTheDuke/lazytest/" - :git/sha "4e4a746bed3eb5642b67d63117aef60954fe424f"} - #_{:mvn/version "1.5.0"} + io.github.noahtheduke/lazytest {:mvn/version "1.6.1"} ;; connection pooling com.zaxxer/HikariCP {:mvn/version "6.2.1"} com.mchange/c3p0 {:mvn/version "0.10.1"} diff --git a/test/next/jdbc/sql/builder_test.clj b/test/next/jdbc/sql/builder_test.clj index e229772..0334601 100644 --- a/test/next/jdbc/sql/builder_test.clj +++ b/test/next/jdbc/sql/builder_test.clj @@ -2,8 +2,7 @@ (ns next.jdbc.sql.builder-test "Tests for the SQL string building functions in next.jdbc.sql.builder." - (:require [lazytest.core :refer [throws?]] - [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing]] + (:require [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing thrown?]] [next.jdbc.quoted :refer [mysql sql-server]] [next.jdbc.sql.builder :as builder])) @@ -159,11 +158,11 @@ (deftest test-for-update (testing "empty example (would be a SQL error)" - (is (throws? IllegalArgumentException - #(builder/for-update :user - {:status 42} - {} - {:table-fn sql-server :column-fn mysql})))) + (is (thrown? IllegalArgumentException + (builder/for-update :user + {:status 42} + {} + {:table-fn sql-server :column-fn mysql})))) (testing "by example" (is (= (builder/for-update :user {:status 42} diff --git a/test/next/jdbc/sql_test.clj b/test/next/jdbc/sql_test.clj index 2049a53..0c5644e 100644 --- a/test/next/jdbc/sql_test.clj +++ b/test/next/jdbc/sql_test.clj @@ -2,8 +2,8 @@ (ns next.jdbc.sql-test "Tests for the syntactic sugar SQL functions." - (:require [lazytest.core :refer [around set-ns-context! throws?]] - [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing]] + (:require [lazytest.core :refer [around set-ns-context!]] + [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing thrown?]] [next.jdbc :as jdbc] [next.jdbc.specs :as specs] [next.jdbc.sql :as sql] @@ -73,8 +73,8 @@ (when-not (xtdb?) ; XTDB does not support min/max on strings? (let [min-name (sql/aggregate-by-keys ds-opts :fruit "min(name)" :all)] (is (= "Apple" min-name)))) - (is (throws? IllegalArgumentException - #(sql/aggregate-by-keys ds-opts :fruit "count(*)" :all {:columns []}))))) + (is (thrown? IllegalArgumentException + (sql/aggregate-by-keys ds-opts :fruit "count(*)" :all {:columns []}))))) (deftest test-get-by-id (let [ds-opts (jdbc/with-options (ds) (default-options))] @@ -259,24 +259,24 @@ (is (= [] (sql/insert-multi! (ds) :fruit [] [])))))) (deftest no-empty-example-maps - (is (throws? clojure.lang.ExceptionInfo - #(sql/find-by-keys (ds) :fruit {}))) - (is (throws? clojure.lang.ExceptionInfo - #(sql/update! (ds) :fruit {} {}))) - (is (throws? clojure.lang.ExceptionInfo - #(sql/delete! (ds) :fruit {})))) + (is (thrown? clojure.lang.ExceptionInfo + (sql/find-by-keys (ds) :fruit {}))) + (is (thrown? clojure.lang.ExceptionInfo + (sql/update! (ds) :fruit {} {}))) + (is (thrown? clojure.lang.ExceptionInfo + (sql/delete! (ds) :fruit {})))) (deftest no-empty-columns - (is (throws? clojure.lang.ExceptionInfo - #(sql/insert-multi! (ds) :fruit [] [[] [] []])))) + (is (thrown? clojure.lang.ExceptionInfo + (sql/insert-multi! (ds) :fruit [] [[] [] []])))) (deftest no-mismatched-columns - (is (throws? IllegalArgumentException - #(sql/insert-multi! (ds) :fruit [{:name "Apple"} {:cost 1.23}])))) + (is (thrown? IllegalArgumentException + (sql/insert-multi! (ds) :fruit [{:name "Apple"} {:cost 1.23}])))) (deftest no-empty-order-by - (is (throws? clojure.lang.ExceptionInfo - #(sql/find-by-keys (ds) :fruit + (is (thrown? clojure.lang.ExceptionInfo + (sql/find-by-keys (ds) :fruit {:name "Apple"} {:order-by []})))) diff --git a/test/next/jdbc_test.clj b/test/next/jdbc_test.clj index 4b75ae8..001ce8b 100644 --- a/test/next/jdbc_test.clj +++ b/test/next/jdbc_test.clj @@ -5,8 +5,8 @@ (:require [clojure.core.reducers :as r] [clojure.string :as str] - [lazytest.core :refer [around throws?]] - [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing]] + [lazytest.core :refer [around]] + [lazytest.experimental.interfaces.clojure-test :refer [deftest is testing thrown?]] [next.jdbc :as jdbc] [next.jdbc.connection :as c] [next.jdbc.prepare :as prep] @@ -259,28 +259,28 @@ VALUES ('Pear', 'green', 49, 47) (is (= 4 (count (jdbc/execute! con ["select * from fruit"])))) (is (= ac (.getAutoCommit con)))))) (testing "with-transaction exception" - (is (throws? Throwable - #(jdbc/with-transaction [t (ds)] - (jdbc/execute! t [" + (is (thrown? Throwable + (jdbc/with-transaction [t (ds)] + (jdbc/execute! t [" INSERT INTO fruit (name, appearance, cost, grade) VALUES ('Pear', 'green', 49, 47) "]) - (is (jdbc/active-tx?) "should be in a transaction") - (is (jdbc/active-tx? t) "connection should be in a transaction") - (throw (ex-info "abort" {}))))) + (is (jdbc/active-tx?) "should be in a transaction") + (is (jdbc/active-tx? t) "connection should be in a transaction") + (throw (ex-info "abort" {}))))) (is (= 4 (count (jdbc/execute! (ds) ["select * from fruit"])))) (is (not (jdbc/active-tx?)) "should not be in a transaction") (with-open [con (jdbc/get-connection (ds))] (let [ac (.getAutoCommit con)] - (is (throws? Throwable - #(jdbc/with-transaction [t con] - (jdbc/execute! t [" + (is (thrown? Throwable + (jdbc/with-transaction [t con] + (jdbc/execute! t [" INSERT INTO fruit (name, appearance, cost, grade) VALUES ('Pear', 'green', 49, 47) "]) - (is (jdbc/active-tx?) "should be in a transaction") - (is (jdbc/active-tx? t) "connection should be in a transaction") - (throw (ex-info "abort" {}))))) + (is (jdbc/active-tx?) "should be in a transaction") + (is (jdbc/active-tx? t) "connection should be in a transaction") + (throw (ex-info "abort" {}))))) (is (= 4 (count (jdbc/execute! con ["select * from fruit"])))) (is (= ac (.getAutoCommit con)))))) (testing "with-transaction call rollback" @@ -1106,8 +1106,8 @@ INSERT INTO fruit (name, appearance) VALUES (?,?) (is (every? #(re-find #"(?i)^(#:fruit)?\{.*:_?id.*\}$" %) (into [] (map pr-str) (jdbc/plan (ds) ["select * from fruit"] (default-options))))) - (is (throws? IllegalArgumentException - #(doall (take 3 (jdbc/plan (ds) ["select * from fruit"])))))) + (is (thrown? IllegalArgumentException + (doall (take 3 (jdbc/plan (ds) ["select * from fruit"])))))) (deftest issue-204 {:context [(around [f] (with-test-db f))]}