Add test for DELETE query which returns removed rows.

This commit is contained in:
Tomasz Rybarczyk 2018-10-08 15:57:33 +02:00
parent 624cf730e6
commit 9ae93cede4
2 changed files with 12 additions and 2 deletions

View File

@ -5,6 +5,7 @@
"decimal.js": "^10.0.0",
"g": "^2.0.1",
"global": "^4.3.2",
"pg": "^6.1.2"
"pg": "^6.1.2",
"pulp": "^12.3.0"
}
}

View File

@ -33,7 +33,7 @@ import Test.Unit.Main (runTest)
withRollback
a
. Connection
. Connection
Aff a
Aff Unit
withRollback conn action = do
@ -135,6 +135,15 @@ main = void $ launchAff do
""") Row0
liftEffect <<< assert $ names == [Row2 "pork" true, Row2 "rookworst" true]
test conn "delete column subset" $ do
insertFood
deleted <- query conn (Query """
DELETE FROM foods
WHERE delicious
RETURNING name, delicious
""") Row0
liftEffect <<< assert $ deleted == [Row2 "pork" true, Row2 "rookworst" true]
test conn "handling instant value" $ do
before <- liftEffect $ (unwrap <<< unInstant) <$> now
insertFood