Add test for remove nil pred from AND
This commit is contained in:
parent
caf904a40d
commit
aacd7aa692
1 changed files with 8 additions and 1 deletions
|
|
@ -4,7 +4,8 @@
|
||||||
:cljs [cljs.test :refer-macros]) [deftest testing is are]]
|
:cljs [cljs.test :refer-macros]) [deftest testing is are]]
|
||||||
[honeysql.types :as sql]
|
[honeysql.types :as sql]
|
||||||
[honeysql.format :refer
|
[honeysql.format :refer
|
||||||
[*allow-dashed-names?* quote-identifier format-clause format]]))
|
[*allow-dashed-names?* quote-identifier format-clause format]]
|
||||||
|
[honeysql.helpers :as helpers]))
|
||||||
|
|
||||||
(deftest test-quote
|
(deftest test-quote
|
||||||
(are
|
(are
|
||||||
|
|
@ -168,3 +169,9 @@
|
||||||
{:values [[1 2] [3 4] [5 6]]}]]}
|
{:values [[1 2] [3 4] [5 6]]}]]}
|
||||||
:parameterizer :none)
|
:parameterizer :none)
|
||||||
["WITH bar (spam, eggs) AS (VALUES (1, 2), (3, 4), (5, 6)) SELECT foo FROM bar1 UNION SELECT foo FROM bar2"]))))
|
["WITH bar (spam, eggs) AS (VALUES (1, 2), (3, 4), (5, 6)) SELECT foo FROM bar1 UNION SELECT foo FROM bar2"]))))
|
||||||
|
|
||||||
|
(deftest where-and
|
||||||
|
(testing "should ignore a nil predicate"
|
||||||
|
(is (= (format (helpers/where [:= :foo "foo"] [:= :bar "bar"] nil)
|
||||||
|
:parameterizer :postgresql)
|
||||||
|
["WHERE (foo = $1 AND bar = $2)" "foo" "bar"]))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue