Add test for allCollections request

This commit is contained in:
Victor Denisov 2016-05-21 13:22:18 -07:00
parent 5c6f015309
commit 76ac212708

View file

@ -4,6 +4,7 @@
module QuerySpec (spec) where
import TestImport
import Control.Exception
import qualified Data.List as L
import qualified Data.Text as T
@ -147,6 +148,14 @@ spec = around withCleanDatabase $ do
liftIO $ (length returnedDocs) `shouldBe` 6001
describe "allCollections" $ do
it "returns all collections in a database" $ do
_ <- db $ insert "team1" ["name" =: "Yankees", "league" =: "American"]
_ <- db $ insert "team2" ["name" =: "Yankees", "league" =: "American"]
_ <- db $ insert "team3" ["name" =: "Yankees", "league" =: "American"]
collections <- db $ allCollections
liftIO $ (L.sort collections) `shouldContain` ["team1", "team2", "team3"]
describe "aggregate" $ do
it "aggregates to normalize and sort documents" $ do
db $ insertAll_ "users" [ ["_id" =: "jane", "joined" =: parseDate "2011-03-02", "likes" =: ["golf", "racquetball"]]