tmp-proc-example-0.7.0.0: Test a simple service with backends running on docker using tmp-proc
Copyright(c) 2020-2021 Tim Emiola
LicenseBSD3
MaintainerTim Emiola <adetokunbo@users.noreply.github.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

TmpProc.Example2.IntegrationSpec

Description

An demo HSpec test that use tmp-proc

Synopsis

Documentation

dbProc :: TmpPostgres Source #

The test uses a Postgres database .

cacheProc :: TmpRedis Source #

The test uses Redis as a cache.

testProcs :: HList '[TmpPostgres, TmpRedis] Source #

Specifies the procs to be launched as test fixtures.

spec :: Spec Source #

Specifies the expected behaviour.

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 the ServerHandle.