Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data WebSocket = WebSocket {
- wsConnect :: WSConnect
- wsChan :: TChan Value
- wsCloseLatch :: MVar ()
- wsAppThread :: Async ()
- data WSConnect = WSConnect {}
- class ToWSConnect a where
- toWSConnect :: HasCallStack => a -> App WSConnect
- data AwaitResult = AwaitResult {
- success :: Bool
- nMatchesExpected :: Int
- matches :: [Value]
- nonMatches :: [Value]
- withWebSocket :: (HasCallStack, ToWSConnect w) => w -> (WebSocket -> App a) -> App a
- withWebSockets :: forall a w. (HasCallStack, ToWSConnect w) => [w] -> ([WebSocket] -> App a) -> App a
- awaitNMatchesResult :: HasCallStack => Int -> (Value -> App Bool) -> WebSocket -> App AwaitResult
- awaitNMatches :: HasCallStack => Int -> (Value -> App Bool) -> WebSocket -> App [Value]
- awaitMatch :: HasCallStack => (Value -> App Bool) -> WebSocket -> App Value
- awaitAnyEvent :: Int -> WebSocket -> App (Maybe Value)
- awaitAtLeastNMatchesResult :: HasCallStack => Int -> (Value -> App Bool) -> WebSocket -> App AwaitAtLeastResult
- awaitAtLeastNMatches :: HasCallStack => Int -> (Value -> App Bool) -> WebSocket -> App [Value]
- awaitNToMMatchesResult :: HasCallStack => Int -> Int -> (Value -> App Bool) -> WebSocket -> App AwaitAtLeastResult
- awaitNToMMatches :: HasCallStack => Int -> Int -> (Value -> App Bool) -> WebSocket -> App [Value]
- assertAwaitResult :: HasCallStack => AwaitResult -> App [Value]
- nPayload :: MakesValue a => a -> App Value
- printAwaitResult :: AwaitResult -> App ()
- printAwaitAtLeastResult :: AwaitAtLeastResult -> App ()
- waitForResponse :: HasCallStack => App Response -> (Response -> App r) -> App r
- assertNoEvent :: HasCallStack => Int -> WebSocket -> App ()
Documentation
WebSocket | |
|
Instances
ToWSConnect WSConnect Source # | |
Defined in Testlib.Cannon |
class ToWSConnect a where Source #
toWSConnect :: HasCallStack => a -> App WSConnect Source #
Instances
ToWSConnect WSConnect Source # | |
Defined in Testlib.Cannon | |
MakesValue user => ToWSConnect user Source # | |
Defined in Testlib.Cannon toWSConnect :: user -> App WSConnect Source # | |
(MakesValue user, MakesValue conn) => ToWSConnect (user, conn) Source # | |
Defined in Testlib.Cannon toWSConnect :: (user, conn) -> App WSConnect Source # | |
(MakesValue user, MakesValue conn, MakesValue client) => ToWSConnect (user, conn, client) Source # | |
Defined in Testlib.Cannon toWSConnect :: (user, conn, client) -> App WSConnect Source # |
data AwaitResult Source #
AwaitResult | |
|
withWebSocket :: (HasCallStack, ToWSConnect w) => w -> (WebSocket -> App a) -> App a Source #
withWebSockets :: forall a w. (HasCallStack, ToWSConnect w) => [w] -> ([WebSocket] -> App a) -> App a Source #
:: HasCallStack | |
=> Int | Number of matches |
-> (Value -> App Bool) | Selection function. Exceptions are *not* caught. |
-> WebSocket | |
-> App AwaitResult |
await
an expected number of notification events on the websocket that
satisfy the provided predicate. If there isn't any new event (matching or
non-matching) for a tSecs
seconds then AwaitResult is a failure. This
function will never terminate if there is a constant stream of events
received. When this functions returns it will push any non-matching
events back to the websocket.
assertAwaitResult :: HasCallStack => AwaitResult -> App [Value] Source #
printAwaitResult :: AwaitResult -> App () Source #
printAwaitAtLeastResult :: AwaitAtLeastResult -> App () Source #
waitForResponse :: HasCallStack => App Response -> (Response -> App r) -> App r Source #
waits for an http response to satisfy a predicate
assertNoEvent :: HasCallStack => Int -> WebSocket -> App () Source #