handleCTypeH success test

This commit is contained in:
Julian K. Arni 2015-02-20 15:22:26 +01:00
parent 5470297bdc
commit b02b67b4b7

View file

@ -125,6 +125,12 @@ spec = describe "Servant.API.ContentTypes" $ do
"𝕺𝖋 𝖘𝖍𝖔𝖊𝖘--𝖆𝖓𝖉 𝖘𝖍𝖎𝖕𝖘--𝖆𝖓𝖉 𝖘𝖊𝖆𝖑𝖎𝖓𝖌-𝖜𝖆𝖝-- " "𝕺𝖋 𝖘𝖍𝖔𝖊𝖘--𝖆𝖓𝖉 𝖘𝖍𝖎𝖕𝖘--𝖆𝖓𝖉 𝖘𝖊𝖆𝖑𝖎𝖓𝖌-𝖜𝖆𝖝-- "
`shouldSatisfy` isJustLeft `shouldSatisfy` isJustLeft
it "returns Just (Right val) if the decoding succeeds" $ do
let val = SomeData "Of cabbages--and kings" 12
handleCTypeH (Proxy :: Proxy '[JSON]) "application/json"
(encode val)
`shouldBe` Just (Right val)
data SomeData = SomeData { record1 :: String, record2 :: Int } data SomeData = SomeData { record1 :: String, record2 :: Int }
deriving (Generic, Eq, Show) deriving (Generic, Eq, Show)