Safe Haskell | Safe-Infered |
---|
Yesod.Test.Json provides convenience functions for working with Test.Hspec and Network.Wai.Test on JSON data.
- testApp :: Application -> AppConfig env extra -> (((APIFunction -> Session ()) -> Assertion) -> Spec) -> IO ()
- type APIFunction = ByteString -> [Text] -> Maybe Value -> Session SResponse
- assertBool :: String -> Bool -> Session ()
- assertString :: String -> Session ()
- assertOK :: SResponse -> Session ()
- assertJSON :: (ToJSON a, FromJSON a) => (a -> (String, Bool)) -> SResponse -> Session ()
- type Session = ReaderT Application (StateT ClientState IO)
- type Assertion = IO ()
- module Test.Hspec
- module Data.Aeson
- data SResponse = SResponse {}
Documentation
testApp :: Application -> AppConfig env extra -> (((APIFunction -> Session ()) -> Assertion) -> Spec) -> IO ()Source
Run a test suite for your Application
type APIFunctionSource
A request to your server.
assertString :: String -> Session ()Source
type Session = ReaderT Application (StateT ClientState IO)
When an assertion is evaluated, it will output a message if and only if the assertion fails.
Test cases are composed of a sequence of one or more assertions.
module Test.Hspec
module Data.Aeson