on master help sign in
handleCTypeH success test
b02b67bJulian K. Arni
test/Servant/API/ContentTypesSpec.hs+6
@@ -125,6 +125,12 @@ spec = describe "Servant.API.ContentTypes" $ do
125 "𝕺𝖋 π–˜π–π–”π–Šπ–˜--𝖆𝖓𝖉 π–˜π–π–Žπ–•π–˜--𝖆𝖓𝖉 π–˜π–Šπ–†π–‘π–Žπ–“π–Œ-π–œπ–†π–-- "
125 "𝕺𝖋 π–˜π–π–”π–Šπ–˜--𝖆𝖓𝖉 π–˜π–π–Žπ–•π–˜--𝖆𝖓𝖉 π–˜π–Šπ–†π–‘π–Žπ–“π–Œ-π–œπ–†π–-- "
126 `shouldSatisfy` isJustLeft
126 `shouldSatisfy` isJustLeft
127
127
128+ it "returns Just (Right val) if the decoding succeeds" $ do
129+ let val = SomeData "Of cabbages--and kings" 12
130+ handleCTypeH (Proxy :: Proxy '[JSON]) "application/json"
131+ (encode val)
132+ `shouldBe` Just (Right val)
133+
128
134
129data SomeData = SomeData { record1 :: String, record2 :: Int }
135data SomeData = SomeData { record1 :: String, record2 :: Int }
130 deriving (Generic, Eq, Show)
136 deriving (Generic, Eq, Show)