amazonka-mtl 0.1.1.2 → 0.1.1.3
raw patch · 4 files changed
+14/−5 lines, 4 files
Files
- amazonka-mtl.cabal +1/−1
- library/Control/Monad/AWS/Matchers.hs +9/−0
- library/Control/Monad/AWS/ViaMock.hs +3/−3
- package.yaml +1/−1
amazonka-mtl.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: amazonka-mtl-version: 0.1.1.2+version: 0.1.1.3 license: MIT license-file: LICENSE maintainer: Freckle Education
library/Control/Monad/AWS/Matchers.hs view
@@ -1,5 +1,14 @@ {-# LANGUAGE AllowAmbiguousTypes #-} +-- | Predicates for matching AWS requests when mocking in tests+--+-- A 'Matcher' is effectively a predicate for an AWS request. It's expected that+-- your tests run in a reader-like monad and implements 'HasMatchers' for its+-- environment. You can then use 'withMatcher' or 'withMatchers' to add mocked+-- responses when matching requests are made within the implementation under+-- test.+--+-- See also the example in "Control.Monad.AWS.ViaMock". module Control.Monad.AWS.Matchers ( Matchers , HasMatchers (..)
library/Control/Monad/AWS/ViaMock.hs view
@@ -20,7 +20,7 @@ -- $ maybe [] (filter matchesPrefix) -- $ resp ^. listBucketsResponse_buckets -- where--- matchesPrefix b = p `T.isPrefixOf` toText (b ^. bucket_name)+-- matchesPrefix b = p \`T.isPrefixOf\` toText (b ^. bucket_name) -- @ -- -- And assuming you've set up your example monad with 'MonadAWS' via 'MockAWS',@@ -37,12 +37,12 @@ -- bucketC = newBucket now "c-bucket" -- buckets = [bucketA, bucketB, bucketC] -- matcher =--- SendMatcher (== newListBuckets)+-- 'SendMatcher' (== newListBuckets) -- $ Right -- $ newListBucketsResponse 200 -- & listBucketsResponse_buckets ?~ buckets ----- withMatcher matcher $ do+-- 'withMatcher' matcher $ do -- buckets <- getBucketsByPrefix "b-" -- buckets `shouldBe` [bucketB] -- @
package.yaml view
@@ -1,5 +1,5 @@ name: amazonka-mtl-version: 0.1.1.2+version: 0.1.1.3 maintainer: Freckle Education category: Utils github: freckle/amazonka-mtl