diff --git a/test/honeysql/format_test.clj b/test/honeysql/format_test.clj index e0f8bca..26f90bc 100644 --- a/test/honeysql/format_test.clj +++ b/test/honeysql/format_test.clj @@ -53,3 +53,13 @@ :columns [:baz] :values [[#sql/array ["one" "two" "three"]]]}) ["INSERT INTO foo (baz) VALUES (ARRAY[?, ?, ?])" "one" "two" "three"]))) + +(deftest union-test + (is (= (format {:union [{:select [:foo] :from [:bar1]} + {:select [:foo] :from [:bar2]}]}) + ["(SELECT foo FROM bar1) UNION (SELECT foo FROM bar2)"]))) + +(deftest union-all-test + (is (= (format {:union-all [{:select [:foo] :from [:bar1]} + {:select [:foo] :from [:bar2]}]}) + ["(SELECT foo FROM bar1) UNION ALL (SELECT foo FROM bar2)"])))