From 24c20c3a2f2691b6eae5dc92f15e5cb22a8a9c96 Mon Sep 17 00:00:00 2001 From: Andrea Richiardi Date: Mon, 24 Sep 2018 22:23:40 -0700 Subject: [PATCH] Add mimimal test for #228 --- test/honeysql/core_test.cljc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/honeysql/core_test.cljc b/test/honeysql/core_test.cljc index 2c3ceb6..f3b9cbf 100644 --- a/test/honeysql/core_test.cljc +++ b/test/honeysql/core_test.cljc @@ -6,7 +6,7 @@ [honeysql.helpers :refer [select modifiers from join left-join right-join full-join where group having order-by limit offset values columns - insert-into with]] + insert-into with merge-where]] honeysql.format-test)) ;; TODO: more tests @@ -215,4 +215,20 @@ (where [:= :id (sql/inline nil)]) sql/format)))) +(deftest merge-where-no-params-test + (testing "merge-where called with just the map as parameter - see #228" + (let [sqlmap (-> (select :*) + (from :table) + (where [:= :foo :bar]))] + (is (= ["SELECT * FROM table WHERE foo = bar"] + (sql/format (apply merge-where sqlmap []))))))) + +(deftest merge-where-test + (is (= ["SELECT * FROM table WHERE (foo = bar AND quuz = xyzzy)"] + (-> (select :*) + (from :table) + (where [:= :foo :bar]) + (merge-where [:= :quuz :xyzzy]) + sql/format)))) + #?(:cljs (cljs.test/run-all-tests))