Update tests

This commit is contained in:
2026-09-30 15:01:17 +03:00
parent cceddad037
commit 6bcab1a0d8
5 changed files with 42 additions and 27 deletions
+7
View File
@@ -10,10 +10,13 @@ module Support
, sec
, stateEvent
, buttonEvent
, withTestLogEnv
) where
import Control.Exception (bracket)
import Control.Monad.Fix (MonadFix (..))
import Data.Aeson (Value, object, (.=))
import Katip (LogEnv, closeScribes, initLogEnv)
import qualified Data.Text as T
import Data.Time (UTCTime (..), utc)
import Data.UUID (nil)
@@ -42,6 +45,10 @@ instance Monad Acc where
instance MonadFix Acc where
mfix f = Acc $ \s -> let (a, s') = runAcc (f a) s in (a, s')
-- | A silent LogEnv: no scribes registered, so nothing is written anywhere.
withTestLogEnv :: (LogEnv -> IO a) -> IO a
withTestLogEnv = bracket (initLogEnv "test" "test") closeScribes
-- | Interpret `HASSEff` in `Acc`: record `CallService`, drop tracing/debug.
interp :: HASSEff a -> Acc a
interp (CallService _ svc) = Acc $ \s -> ((), s ++ [svc])