From 8dac250e10a565a6283ca7f2842aac0b664f3b1e Mon Sep 17 00:00:00 2001 From: Victor Denisov Date: Sun, 28 May 2017 12:38:34 -0700 Subject: [PATCH] Add test for correct delete count --- test/QuerySpec.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/QuerySpec.hs b/test/QuerySpec.hs index 33232cc..d1213a4 100644 --- a/test/QuerySpec.hs +++ b/test/QuerySpec.hs @@ -392,6 +392,15 @@ spec = around withCleanDatabase $ do updatedResult <- db $ rest =<< find ((select [] "bigCollection") {project = ["_id" =: (0 :: Int)]}) length updatedResult `shouldBe` 0 + describe "deleteAll" $ do + it "returns correct result" $ do + wireVersion <- getWireVersion + when (wireVersion > 1) $ do + _ <- db $ insert "testCollection" [ "myField" =: "myValue" ] + _ <- db $ insert "testCollection" [ "myField" =: "myValue" ] + res <- db $ deleteAll "testCollection" [ (["myField" =: "myValue"], []) ] + nRemoved res `shouldBe` 2 + describe "allCollections" $ do it "returns all collections in a database" $ do _ <- db $ insert "team1" ["name" =: "Yankees", "league" =: "American"]