From 76ac212708bf65209f5545e2c52f0c8b432283ba Mon Sep 17 00:00:00 2001 From: Victor Denisov Date: Sat, 21 May 2016 13:22:18 -0700 Subject: [PATCH] Add test for allCollections request --- test/QuerySpec.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/QuerySpec.hs b/test/QuerySpec.hs index 671b441..ebbea72 100644 --- a/test/QuerySpec.hs +++ b/test/QuerySpec.hs @@ -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"]]