base test setup

This commit is contained in:
Lucy Cifferello
2020-03-12 17:13:58 -06:00
parent 4454351593
commit 924f5df8e1
3 changed files with 60 additions and 0 deletions

29
test/TestImport.hs Normal file
View File

@@ -0,0 +1,29 @@
{-# LANGUAGE QuasiQuotes #-}
module TestImport
( module TestImport
, module X
) where
import Startlude
import Application (makeFoundation, makeLogWare)
import Foundation as X
import Test.Hspec as X
import Yesod.Default.Config2 (useEnv, loadYamlSettings)
import Yesod.Test as X
import Yesod.Core.Unsafe (fakeHandlerGetLogger)
runHandler :: Handler a -> YesodExample AgentCtx a
runHandler handler = do
app <- getTestYesod
fakeHandlerGetLogger appLogger app handler
withApp :: SpecWith (TestApp AgentCtx) -> Spec
withApp = before $ do
settings <- loadYamlSettings
["config/settings.yml"]
[]
useEnv
foundation <- makeFoundation settings
logWare <- liftIO $ makeLogWare foundation
return (foundation, logWare)