server/tests: tiny refactoring
This commit is contained in:
parent
94dbfd4fde
commit
56c8fbea02
1 changed files with 8 additions and 6 deletions
|
@ -13,6 +13,12 @@ import Test.Hspec.Wai
|
|||
import Servant
|
||||
import Servant.Server.UsingConfigSpec.TestCombinators
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
spec1
|
||||
spec2
|
||||
spec3
|
||||
|
||||
-- * API
|
||||
|
||||
type OneEntryAPI =
|
||||
|
@ -42,8 +48,8 @@ oneEntryTwiceApp = serve (Proxy :: Proxy OneEntryTwiceAPI) config $
|
|||
|
||||
-- * tests
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
spec1 :: Spec
|
||||
spec1 = do
|
||||
describe "accessing config entries from custom combinators" $ do
|
||||
with (return oneEntryApp) $ do
|
||||
it "allows retrieving a ConfigEntry" $ do
|
||||
|
@ -54,8 +60,6 @@ spec = do
|
|||
get "/foo" `shouldRespondWith` "\"configEntryTwice\""
|
||||
get "/bar" `shouldRespondWith` "\"configEntryTwice\""
|
||||
|
||||
spec2
|
||||
|
||||
type InjectAPI =
|
||||
InjectIntoConfig :> "untagged" :> ExtractFromConfig :>
|
||||
Get '[JSON] String :<|>
|
||||
|
@ -79,8 +83,6 @@ spec2 = do
|
|||
it "allows to inject tagged config entries" $ do
|
||||
get "/tagged" `shouldRespondWith` "\"tagged: injected\""
|
||||
|
||||
spec3
|
||||
|
||||
type SubConfigAPI =
|
||||
"foo" :> ExtractFromConfig :> Get '[JSON] String :<|>
|
||||
SubConfig "sub" '[String] :>
|
||||
|
|
Loading…
Reference in a new issue