graphql-engine/server/lib/api-tests/ghci/fixtureRepl.ghci
Tom Harding 8325c03500 Update the fixture repl macro
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7366
GitOrigin-RevId: f34a42c4dfd2dc257ffe39f4a0db12beb2630629
2022-12-22 11:26:48 +00:00

21 lines
664 B
Plaintext

import Data.List
:{
fixtureReplMacro :: String -> IO String
fixtureReplMacro module_ = do
return $ unlines
[ "import Data.Aeson.Encode.Pretty (encodePretty)",
"import Data.ByteString.Lazy.Char8 qualified as BS",
"import Harness.Test.Fixture",
"import Harness.Logging",
"import System.Environment",
":m + *SpecHook *" ++ module_,
"Right mode <- fmap lookupTestingMode getEnvironment",
"te <- setupTestEnvironment mode (Logger $ BS.putStrLn . encodePretty . fromLoggableMessage)",
"te",
"putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\""
]
:}
:def fixtureRepl fixtureReplMacro