Skip to content

Commit

Permalink
Adds test case for not-exists
Browse files Browse the repository at this point in the history
  • Loading branch information
solatis committed Jun 9, 2016
1 parent 9783e4a commit 173e0a8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/suricatta/dsl_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,15 @@
(dsl/where ["table.author_id = author.id"])))))]
(is (= (fmt/sql q)
"select fullname from author where exists (select id from table where (table.author_id = author.id))"))))
)

(testing "Nested select in where clause using not-exists"
(let [q (-> (dsl/select :fullname)
(dsl/from :author)
(dsl/where (dsl/not-exists (-> (dsl/select :id)
(dsl/from :table)
(dsl/where ["table.author_id = author.id"])))))]
(is (= (fmt/sql q)
"select fullname from author where not exists (select id from table where (table.author_id = author.id))")))))

(deftest dsl-insert
(testing "Insert statement from values as maps"
Expand Down

0 comments on commit 173e0a8

Please sign in to comment.