Skip to content

Commit

Permalink
Add unit test to prevent regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
MonaMayrhofer committed Mar 26, 2024
1 parent 335b9e0 commit 0bb5b45
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Test/QueryBuilderSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ tests = do
(toSQL theQuery) `shouldBe` ("SELECT posts.id, posts.title, posts.external_url, posts.created_at, posts.public, posts.created_by, posts.category_id FROM posts WHERE posts.external_url IS NOT ?", [Plain "null"])

describe "filterWhereIn" do
it "should work with #id if the Model is suitable" do
let theValues :: [UUID] = ["b80e37a8-41d4-4731-b050-a716879ef1d1", "629b7ee0-3675-4b02-ba3e-cdbd7b513553"]
let theQuery = query @Post
|> filterWhereIn (#id, theValues)

(toSQL theQuery) `shouldBe` ("SELECT posts.id, posts.title, posts.external_url, posts.created_at, posts.public, posts.created_by, posts.category_id FROM posts WHERE posts.id IN ?", [Many [Plain "(", Plain "'b80e37a8-41d4-4731-b050-a716879ef1d1'", Plain ",", Plain "'629b7ee0-3675-4b02-ba3e-cdbd7b513553'", Plain ")"]])
it "should produce a SQL with a WHERE condition" do
let theValues :: [Text] = ["first", "second"]
let theQuery = query @Post
Expand Down

0 comments on commit 0bb5b45

Please sign in to comment.