test: move prepared statements config related tests to spec tests

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
Taimoor Zaeem
2026-07-07 23:32:40 +05:00
parent 44edf962d8
commit c03ac09dbb
7 changed files with 47 additions and 42 deletions
@@ -0,0 +1,33 @@
module Feature.Query.PreparedStatementsSpec where
import Network.HTTP.Types
import Test.Hspec hiding (pendingWith)
import Test.Hspec.Wai
import Text.Heredoc
import PostgREST.Config (AppConfig (..))
import Protolude hiding (get)
import SpecHelper
spec :: SpecWithConfig
spec withConfig = do
withConfig baseCfg { configDbPreparedStatements = True } $
it "should use prepared statements when the setting is enabled" $
request methodPost "/rpc/uses_prepared_statements"
[] ""
`shouldRespondWith`
[str|true|]
{ matchStatus = 200 }
withConfig baseCfg { configDbPreparedStatements = False } $
it "should not use any prepared statements when the setting is disabled" $ do
request methodGet "/never_prepared"
[] ""
`shouldRespondWith` 200
request methodPost "/rpc/never_uses_prepared_statements"
[] ""
`shouldRespondWith`
[str|true|]
{ matchStatus = 200 }