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 committed Mar 19, 2019
1 parent 06726c5 commit 3cbf665
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 @@ -163,9 +163,12 @@ test-suite integration
, hspec
, hspec-core
, http-client
, http-api-data
, http-types
, aeson-qq
, lens
, process
, 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 @@ -21,6 +21,9 @@ module Test.Integration.Framework.DSL

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

import Prelude hiding
Expand All @@ -32,12 +35,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 @@ -49,6 +58,8 @@ import Test.Integration.Framework.Request
( RequestException (..), unsafeRequest, ($-) )
import Test.Integration.Framework.Scenario
( Scenario )
import Web.HttpApiData
( ToHttpApiData (..) )

--
-- SCENARIO
Expand Down Expand Up @@ -130,3 +141,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 3cbf665

Please sign in to comment.