MFlow-0.4.6.0: stateful, RESTful web framework

Safe HaskellNone
LanguageHaskell98

MFlow.Forms.Test

Description

 

Synopsis

Documentation

class Generate a where Source

Methods

generate :: IO a Source

runTest :: [(Int, Flow)] -> IO () Source

Run a list of flows with a number of simultaneous threads

inject :: MonadIO m => m b -> (Int -> b) -> m b Source

Inject substitutes an expression by other. It may be used to override ask interaction with the user. It should bee used infix for greater readability:

ask something    `inject` const some other

The parameter passed is the test number if the flow has not been executed by runTest, inject return the original

ask :: (Generate a, MonadIO m, Functor m, FormInput v, Typeable v) => View v m a -> FlowM v m a Source

A simulated ask that generate simulated user input of the type expected.

It forces the web page rendering, since it is monadic and can contain side effects and load effects to be tested.

it is a substitute of ask from MFlow.Forms for testing purposes.

askt :: (MonadIO m, FormInput v) => (Int -> a) -> View v m a -> FlowM v m a Source

Instead of generating a result like ask, the result is given as the first parameter so it does not need a Generate instance.

It forces the web page rendering, since it is monadic so it can contain side effects and load effects to be tested.

getUser :: (FormInput view, Typeable view, Functor m, MonadIO m) => Maybe String -> View view m (Maybe (String, String), Maybe String) -> FlowM view m String Source

verify :: a -> (Bool, String) -> a Source

a pure version of verifyM