sydtest-wai-0.1.0.0: A wai companion library for sydtest
Safe HaskellNone
LanguageHaskell2010

Test.Syd.Wai.Def

Synopsis

Documentation

waiClientSpec :: Application -> TestDefM (Manager ': outers) (WaiClient ()) result -> TestDefM outers oldInner result Source #

Run a given Application around every test.

This provides a 'WaiClient ()' which contains the port of the running application.

waiClientSpecWith :: IO Application -> TestDefM (Manager ': outers) (WaiClient ()) result -> TestDefM outers oldInner result Source #

Run a given Application, as built by the given action, around every test.

waiClientSpecWithSetupFunc :: (Manager -> oldInner -> SetupFunc (Application, env)) -> TestDefM (Manager ': outers) (WaiClient env) result -> TestDefM outers oldInner result Source #

Run a given Application, as built by the given SetupFunc, around every test.

waiClientSpecWithSetupFunc' :: (Manager -> oldInner -> SetupFunc (Application, env)) -> TestDefM (Manager ': outers) (WaiClient env) result -> TestDefM (Manager ': outers) oldInner result Source #

Run a given Application, as built by the given SetupFunc, around every test.

This function doesn't set up the Manager like waiClientSpecWithSetupFunc does.

waiClientSetupFunc :: Manager -> Application -> env -> SetupFunc (WaiClient env) Source #

A SetupFunc for a WaiClient, given an Application and user-defined env.

wit :: forall env e outers. (HasCallStack, IsTest (WaiClient env -> IO e), Arg1 (WaiClient env -> IO e) ~ (), Arg2 (WaiClient env -> IO e) ~ WaiClient env) => String -> WaiClientM env e -> TestDefM outers (WaiClient env) () Source #

Define a test in the 'WaiClientM site' monad instead of IO.

Example usage:

waiClientSpec exampleApplication $ do
  describe "/" $ do
    wit "works with a get" $
      get "/" `shouldRespondWith` 200
    wit "works with a post" $
      post "/" `shouldRespondWith` ""

waiSpec :: Application -> TestDef outers PortNumber -> TestDef outers () Source #

Run a given Application around every test.

This provides the port on which the application is running.

waiSpecWith :: (forall r. (Application -> IO r) -> IO r) -> TestDef outers PortNumber -> TestDef outers () Source #

Run a Application around every test by setting it up with the given setup function.

This provides the port on which the application is running.

waiSpecWith' :: (forall r. (Application -> IO r) -> inner -> IO r) -> TestDef outers PortNumber -> TestDef outers inner Source #

Run a Application around every test by setting it up with the given setup function that can take an argument. a This provides the port on which the application is running.

waiSpecWithSetupFunc :: SetupFunc Application -> TestDef outers PortNumber -> TestDef outers () Source #

Run a Application around every test by setting it up with the given SetupFunc. a This provides the port on which the application is running.

waiSpecWithSetupFunc' :: (inner -> SetupFunc Application) -> TestDef outers PortNumber -> TestDef outers inner Source #

Run a Application around every test by setting it up with the given SetupFunc and inner resource. a This provides the port on which the application is running.

applicationSetupFunc :: Application -> SetupFunc PortNumber Source #

A SetupFunc to run an application and provide its port.

managerSpec :: TestDefM (Manager ': outers) inner result -> TestDefM outers inner result Source #

Create a Manager before all tests in the given group.