module Pqi.Conformance.Operation.GetNotice
( spec,
)
where
import qualified Pqi
import Pqi.Conformance.Harness
import Pqi.Conformance.Prelude
import Test.Hspec
spec :: Pqi.Adapter -> SpecWith ByteString
spec :: Adapter -> SpecWith ByteString
spec Adapter
adapter =
String -> SpecWith ByteString -> SpecWith ByteString
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"getNotice" do
String
-> (ByteString -> IO ()) -> SpecWith (Arg (ByteString -> IO ()))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"yields the formatted notice while enabled and then drains" \ByteString
conninfo ->
Adapter
-> ByteString
-> (Connection -> IO (Maybe ByteString, Maybe ByteString))
-> IO ()
forall a.
(Eq a, Show a, HasCallStack) =>
Adapter -> ByteString -> (Connection -> IO a) -> IO ()
differential Adapter
adapter ByteString
conninfo \Connection
connection -> do
Connection -> IO ()
Pqi.enableNoticeReporting Connection
connection
_ <- Connection -> ByteString -> IO (Maybe Result)
Pqi.exec Connection
connection ByteString
"do $$ begin raise notice 'conformance notice'; end $$"
firstNotice <- Pqi.getNotice connection
afterDrain <- Pqi.getNotice connection
pure (firstNotice, afterDrain)