Skip to content

Commit

Permalink
Add and export (</>), (!!), json to DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking authored and rvl committed Mar 20, 2019
1 parent ba6f35f commit 2dacf8f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cardano-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ test-suite integration
, hspec
, hspec-core
, http-client
, http-api-data
, http-types
, aeson-qq
, lens
, mtl
, process
, say
, template-haskell
, text
, transformers

Expand Down
23 changes: 23 additions & 0 deletions test/integration/Test/Integration/Framework/DSL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module Test.Integration.Framework.DSL

-- * Helpers
, ($-)
, (</>)
, (!!)
, json
) where

import Prelude hiding
Expand All @@ -34,12 +37,18 @@ import Control.Monad.Fail
( MonadFail (..) )
import Control.Monad.IO.Class
( MonadIO, liftIO )
import Data.Aeson.QQ
( aesonQQ )
import Data.Function
( (&) )
import Data.List
( (!!) )
import Data.Text
( Text )
import GHC.Generics
( Generic )
import Language.Haskell.TH.Quote
( QuasiQuoter )
import Network.HTTP.Client
( Manager )
import Test.Hspec.Core.Spec
Expand All @@ -51,6 +60,8 @@ import Test.Integration.Framework.Request
( RequestException (..), request, request_, successfulRequest, ($-) )
import Test.Integration.Framework.Scenario
( Scenario )
import Web.HttpApiData
( ToHttpApiData (..) )

--
-- SCENARIO
Expand Down Expand Up @@ -132,3 +143,15 @@ wantedErrorButSuccess
-> m void
wantedErrorButSuccess =
fail . ("expected an error but got a successful response: " <>) . show


--
-- HELPERS
--

json :: QuasiQuoter
json = aesonQQ

infixr 5 </>
(</>) :: ToHttpApiData a => Text -> a -> Text
base </> next = mconcat [base, "/", toQueryParam next]

0 comments on commit 2dacf8f

Please sign in to comment.