Copyright | (c) 2020-2021 Tim Emiola |
---|---|
License | BSD3 |
Maintainer | Tim Emiola <adetokunbo@users.noreply.github.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
An demo HSpec
test that use tmp-proc
Synopsis
- dbProc :: TmpPostgres
- cacheProc :: TmpRedis
- testProcs :: HList '[TmpPostgres, TmpRedis]
- spec :: Spec
- hasInCache :: HasHandle TmpRedis procs => ServerHandle procs -> ContactID -> IO Bool
- hasInDb :: ServerHandle '[TmpPostgres, TmpRedis] -> ContactID -> IO Bool
- type Fixture = (ServerHandle '[TmpPostgres, TmpRedis], ClientEnv)
- mkFixture :: IO Fixture
- shutdown' :: Fixture -> IO ()
- clientEnvOf :: AreProcs procs => ServerHandle procs -> IO ClientEnv
- testContact :: Contact
Documentation
dbProc :: TmpPostgres Source #
The test uses a Postgres database .
testProcs :: HList '[TmpPostgres, TmpRedis] Source #
Specifies the procs to be launched as test fixtures.
hasInCache :: HasHandle TmpRedis procs => ServerHandle procs -> ContactID -> IO Bool Source #
Simplifies the test cases
Note the use of the HasHandle
constraint to indicate what TmpProcs the function uses.
hasInDb :: ServerHandle '[TmpPostgres, TmpRedis] -> ContactID -> IO Bool Source #
Simplifies the test cases
Here, ServerHandle specifies the full list of types required by the calling test code.
type Fixture = (ServerHandle '[TmpPostgres, TmpRedis], ClientEnv) Source #
The full test fixture.
It allows tests to
- use the servant client to invoke the backend
- check the state of service backends via the
ProcHandles
in theServerHandle
.
clientEnvOf :: AreProcs procs => ServerHandle procs -> IO ClientEnv Source #