From 9ae93cede46bd4ba4fcb14c8729d0ef63c1feae6 Mon Sep 17 00:00:00 2001 From: Tomasz Rybarczyk Date: Mon, 8 Oct 2018 15:57:33 +0200 Subject: [PATCH] Add test for DELETE query which returns removed rows. --- package.json | 3 ++- test/Main.purs | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9984961..a85d799 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/test/Main.purs b/test/Main.purs index a94236f..6dfb7c4 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -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