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