Add unit test for upserted
This commit is contained in:
parent
a1e19379f6
commit
9bd0dff6ee
1 changed files with 5 additions and 0 deletions
|
@ -324,6 +324,11 @@ spec = around withCleanDatabase $ do
|
||||||
res <- db $ updateMany "testCollection" [(["myField" =: "myValue"], ["$set" =: ["myField" =: "newValue"]], [MultiUpdate])]
|
res <- db $ updateMany "testCollection" [(["myField" =: "myValue"], ["$set" =: ["myField" =: "newValue"]], [MultiUpdate])]
|
||||||
nMatched res `shouldBe` 2
|
nMatched res `shouldBe` 2
|
||||||
nModified res `shouldBe` (Just 2)
|
nModified res `shouldBe` (Just 2)
|
||||||
|
it "returns correct number of upserted" $ do
|
||||||
|
wireVersion <- getWireVersion
|
||||||
|
when (wireVersion > 1) $ do
|
||||||
|
res <- db $ updateMany "testCollection" [(["myField" =: "myValue"], ["$set" =: ["myfield" =: "newValue"]], [Upsert])]
|
||||||
|
(length $ upserted res) `shouldBe` 1
|
||||||
|
|
||||||
describe "delete" $ do
|
describe "delete" $ do
|
||||||
it "actually deletes something" $ do
|
it "actually deletes something" $ do
|
||||||
|
|
Loading…
Reference in a new issue