esqueleto/test/Common/Test/Select.hs
Matt Parsons 34047e1f5f
Pass ConnectionPool to tests (#262)
* rewriting tests

* tests now run in 1.45 seconds

* tests pass

* fix json

* fix tests

* add helper for setting the database state

* clean things up a bit
2021-05-28 15:34:56 -06:00

23 lines
741 B
Haskell

module Common.Test.Select where
import Common.Test.Import
testSelect :: SpecDb
testSelect = do
describe "select" $ do
itDb "works for a single value" $ do
ret <- select $ return $ val (3 :: Int)
asserting $ ret `shouldBe` [ Value 3 ]
itDb "works for a pair of a single value and ()" $ do
ret <- select $ return (val (3 :: Int), ())
asserting $ ret `shouldBe` [ (Value 3, ()) ]
itDb "works for a single ()" $ do
ret <- select $ return ()
asserting $ ret `shouldBe` [ () ]
itDb "works for a single NULL value" $ do
ret <- select $ return nothing
asserting $ ret `shouldBe` [ Value (Nothing :: Maybe Int) ]