update to lazytest 1.6.1
revert throws? back to thrown? Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
9d1c35b86c
commit
1642cc04ca
4 changed files with 39 additions and 43 deletions
5
deps.edn
5
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"}
|
||||
|
|
|
|||
|
|
@ -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,8 +158,8 @@
|
|||
|
||||
(deftest test-for-update
|
||||
(testing "empty example (would be a SQL error)"
|
||||
(is (throws? IllegalArgumentException
|
||||
#(builder/for-update :user
|
||||
(is (thrown? IllegalArgumentException
|
||||
(builder/for-update :user
|
||||
{:status 42}
|
||||
{}
|
||||
{:table-fn sql-server :column-fn mysql}))))
|
||||
|
|
|
|||
|
|
@ -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 []}))))
|
||||
|
||||
|
|
|
|||
|
|
@ -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,8 +259,8 @@ 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)]
|
||||
(is (thrown? Throwable
|
||||
(jdbc/with-transaction [t (ds)]
|
||||
(jdbc/execute! t ["
|
||||
INSERT INTO fruit (name, appearance, cost, grade)
|
||||
VALUES ('Pear', 'green', 49, 47)
|
||||
|
|
@ -272,8 +272,8 @@ VALUES ('Pear', 'green', 49, 47)
|
|||
(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]
|
||||
(is (thrown? Throwable
|
||||
(jdbc/with-transaction [t con]
|
||||
(jdbc/execute! t ["
|
||||
INSERT INTO fruit (name, appearance, cost, grade)
|
||||
VALUES ('Pear', 'green', 49, 47)
|
||||
|
|
@ -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))]}
|
||||
|
|
|
|||
Loading…
Reference in a new issue